|
docker search
searchterm |
Search Docker Hub for images
|
|
docker pull
user/image |
Downloads an image from Docker Hub
|
|
docker login
|
Authenticate to Docker Hub (or other Docker registry)
|
|
docker push
user/image⠀⠀⠀ |
Uploads an image to Docker Hub. You must be authenticated to run this command
|
|
docker info
|
Retrieves docker configuration
|
|
docker version
|
Retrieves docker versioning
|
|
docker ps
|
List all running containers
|
|
docker ps -a
|
List all container instances, with their ID and status
|
|
docker images
|
Lists all images on the local machine
|
|
docker history <user>/<image>
|
Lists the history of an image
|
|
docker logs <container>
|
Displays the logs from a running container
|
|
docker port <container>
|
Displays the exposed port of a running container
|
|
docker diff <container>
|
Lists the changes made to a container
|
|
docker logs [-f] <container>
|
Read container stdout
|
|
docker top <container>
|
Show running processes
|
|
docker inspect <container>
|
Show container configuration
|
|
docker events
|
Show container events
|
|
docker network ls
|
List networks
|
|
docker network inspect <Network>
|
Inspect a network
|
|
docker network create <Network>
|
Create a network
|
|
docker network rm <Network>
|
Removes a network
|
|
docker network connect <Network> <Container>
|
Connect a container to the network
|
|
docker network connect --ip <IP> <Network> <Container>
|
Specify the IP address of container interface
|
|
docker network disconnect <Network_Name> <Container>
|
Disconnect container from network
|
|
docker run -it user/image
|
Runs an image, creating a container and changing the terminal to the terminal within the container
|
|
docker run -p <hostport>:<containerport> -d user/image
|
Run an image in detached mode with port forwarding
|
|
docker start <container>
|
Start a container
|
|
docker exec <container> [shell command]
|
Executes a command within a running container, e.g. /bin/bash
|
|
docker attach <container>
|
Changes the command prompt from the host to a running container
|
|
docker stop <container>
|
Stop a container
|
|
docker rm -f <container>
|
Delete a container
|
|
docker create <image>:<tag>
|
Create image
|
|
docker rmi <image>
|
Delete an image
|
|
docker tag <user>/<image>:<tag> <user>/<image>:<new tag>
|
Add a new tag to an image
|
|
ctrl+p then ctrl+q
|
Changes the command prompt from the host to a running container
|
|
sudo docker commit containterID username/imagename
|
Commit from container to an image
|
|
docker push username/imagename
|
Docker push example (after logging)
|
|
docker run -it -v /host/directory:/container/directory [options] image [command]
|
Mount a host directory in a Docker container
|
|
docker cp /host/directory/file.ext container:/container/directory
|
Copy file from host machine to docker container
|
|
docker rmi $(docker images -a -q)
|
Delete all Docker images
|
|
docker rm $(sudo docker ps -a -q)
|
Delete all stopped containers
|
|
docker rm $(sudo docker ps -a | grep Exit | cut -d ' ' -f 1)
|
Delete all containers in Exit state
|
|
docker save imagename > filename.tar
|
Export image to a file
|
|
docker load < filename.tar
|
Load image from file
|
|
docker [command] --help
|
Command help
|
|
-p, –-publish
|
Host to container port mapping
|
|
--publish-all
|
Publish all ports
|
|
-d, –-detach
|
Run in background
|
|
-e, –-env
|
Set env vars
|
|
-v, --volume
|
Mount files or directories
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.