File me Issues or star this repo.
1.1 Docker Trouble Shooting
Name | Summary |
Docker push: manifest invalid | Re-push a new version of the same docker tag may fail, due to permission |
Docker pull: missing signature key | Docker push again to resolve the issue |
Docker cp: Error response from daemon: not a directory | container folder is in a symbol link |
Find process id by container name | docker top $container_id , or docker top $container_name |
List resource usage by containers | docker stats |
Get dockerd storage driver | docker info , then check Storage Driver |
docker-containerd-shim | The Docker four components: Docker engine , containerd , containerd-shm and runC |
Name | Summary |
Start a ubuntu test env | docker run ubuntu:16.04 /bin/echo hello world |
Start a ubuntu 18.04 test env | docker run ubuntu:18.04 /bin/echo hello world |
Start a container run and stop | docker run --rm ubuntu:18.04 /bin/echo hello world |
Start a debian9 test env | docker run debian:9 /bin/echo hello world |
Start a centos test env | docker run centos:centos6 /bin/echo hello world |
Start a jenkins server | docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts |
Start a nginx server | docker run -t -d -p 8080:80 --name nginx-test nginx |
Start a nexus server | docker run -d -p 8082:8081 --name nexus -v /data/nexus-data:/nexus-data sonatype/docker-nexus3 |
Start a sshd server | docker run -t -d --privileged -p 5022:22 denny/sshd:latest /usr/sbin/sshd -D |
Start a ftp server | docker run -t -d -p 21:21 -p 20:20 -e USERNAME=${username} -e PASSWORD=${password} denny/proftproftpd:v1 |
Name | Summary |
Start docker container | docker run -p 4000:80 imgname |
Start docker container in detached mode | docker run -d -p 4000:80 imgname |
Start container with entrypoint changed | docker run -t -d --entrypoint=/bin/sh "$docker_image" |
Enter a running container | docker exec -it <container-id> sh |
Upload local file to container filesystem | docker cp /tmp/foo.txt mycontainer:/foo.txt |
Download container file local filesystem | docker cp mycontainer:/foo.txt /tmp/foo.txt |
Stop container | docker stop <hash> |
Remove container | docker rm <hash> |
Remove all containers | docker rm $(docker ps -a -q) |
Force shutdown of one given container | docker kill <hash> |
Login to docker hub | docker login |
Tag <image> | docker tag <image> username/repo:tag |
Docker push a tagged image to repo | docker push username/repo:tag |
Run image from a given tag | docker run username/repo:tag |
Create docker image | docker build -t denny/image:test . |
Name | Summary |
Delete all containers | delete-all-containers.sh |
Remove unused docker images | delete-unused-images.sh |
Docker prune images | docker image prune -f |
Docker prune volumes | docker volume prune -f |
Remove the specified image | docker rmi <imagename> |
Remove all docker images | docker rmi $(docker images -q) |
Remove orphaned docker volumes | docker volume rm $(docker volume ls -qf dangling=true) |
Remove dead containers | docker rm $(docker ps --filter status=dead -qa) |
Remove exited containers | docker rm $(docker ps --filter status=exited -qa) |
Name | Summary |
Change restart policy | restart: always , Link: Compose file version 3 reference |
Mount file as volume | $PWD/httpd/httpd.conf:/usr/local/apache2/conf/httpd.conf:ro GitHub: sample-mount-file.yml |
Start compose env | docker-compose up , docker-compose up -d |
Stop compose env | docker-compose down , docker-compose down -v |
Check logs | docker-compose logs |
Name | Summary |
Start docker container | docker run -p 4000:80 <imgname> |
Start docker container in detached mode | docker run -d -p 4000:80 imgname |
Start docker container and remove when exit | docker run -rm -it <imgname> sh |
Enter a running container | docker exec -it [container-id] sh |
Stop container | docker stop <hash> |
List all containers | docker ps , docker ps -a |
Remove container | docker rm <hash> , docker rm $(docker ps -a -q) |
Force shutdown of one given container | docker kill <hash> |
Login to docker hub | docker login |
Run image from a given tag | docker run username/repo:tag |
Tail container logs | docker logs --tail 5 $container_name |
Check container healthcheck status | docker inspect --format '{{.State.Health}}' $container_name |
List containers by labels | docker ps --filter "label=org.label-schema.group" |
Name | Summary |
List all images | docker images , docker images -a |
Create docker image | docker build -t denny/image:<tag> . |
Docker push a tagged image to repo | docker push denny/image:<tag> |
Show the history of an image | docker history <image_name> |
Export image to file | docker save <image_name> > my_img.tar |
Load image to local registry | docker load -i my_img.tar |
Tag <image> | docker tag <image> username/repo:tag |
Name | Summary |
Run container mounting socket file | docker run -v /var/run/docker.sock:/var/run/docker.sock -it alpine sh |
A different docker socket file | export DOCKER_HOST=unix:///my/docker.sock |
List containers | curl -XGET --unix-socket /var/run/docker.sock http://localhost/containers/json |
Stop container | curl -XPOST --unix-socket /var/run/docker.sock http://localhost/containers/<container_id>/stop |
Start container | curl -XPOST --unix-socket /var/run/docker.sock http://localhost/containers/<container_id>/start |
List events | curl --unix-socket /var/run/docker.sock http://localhost/events |
Create container | curl -XPOST --unix-socket /var/run/docker.sock -d '{"Image":"nginx:alpine"}' -H 'Content-Type: application/json' http://localhost/containers/create |
Links | Link: Develop with Docker Engine SDKs and API |
Name | Summary |
Docker files | /var/lib/docker , /var/lib/docker/devicemapper/mnt |
Docker for Mac | ~/Library/Containers/com.docker.docker/Data/ |
1.13 Ubuntu docker: Install missing packages
Name | Summary |
Pull ubuntu docker image | docker pull ubuntu |
man: command not found | apt-get update , apt-get install man |
ping: command not found | apt-get update , apt-get install iputils-ping |
dig: command not found | apt-get install dnsutils |
Name | Summary |
Tail container logs | docker logs --tail 5 $container_name |
Check container healthcheck status | docker inspect --format '{{.State.Health}}' $container_name |
List containers | docker ps |
List all containers | docker ps -a |
List containers by labels | docker ps --filter "label=org.label-schema.group" |
List all images | docker images -a |
License: Code is licensed under MIT License.
https://github.com/JCMais/docker-linux-ci/blob/master/debian.dockerfile#L15-L16