- Docker Command Cheat Sheet
- Docker Run Cheat Sheet Download
- Docker Run Cheat Sheet Excel
- Docker Run Cheat Sheet
- Docker Compose Cheat Sheet
Complete Docker CLI
Docker has a networks feature. Not much is known about it, so this is a good place to expand the cheat sheet. There is a note saying that it's a good way to configure docker containers to talk to each other without using ports. See working with networks for more details. Docker Cheat Sheet Process Management # Show all running docker containers docker ps # Show all docker containers docker ps -a # Run a container docker run: # Run a container and connect to it docker run -it: # Run a container in the background docker run -d: # Stop a container docker stop. Docker-cheat-sheet Docker Commands, Help & Tips. We could do '$ docker container run -publish 8000:80 -detach nginx' to use port 8000. The Ultimate Docker Cheat Sheet Docker - Beginners Intermediate Advanced View on GitHub Join Slack The Ultimate Docker Cheat Sheet. Complete Docker CLI. Container Management CLIs. Inspecting The Container. Interacting with Container. Image Management Commands. Image Transfer Comnands. Builder Main Commands.
Container Management CLIs
Inspecting The Container
Interacting with Container
Image Management Commands
Image Transfer Comnands
Builder Main Commands
The Docker CLI
Manage images
docker build
Create an image
from a Dockerfile.
docker run
Run a command in an image
.
Manage containers
docker create
Example
Create a container
from an image
.
docker exec
Example
Run commands in a container
.
docker start
Start/stop a container
.
docker ps
Manage container
s using ps/kill.
Images
docker images
Manages image
s.
docker rmi
Deletes image
s.
Also see
- Getting Started(docker.io)
Inheritance
Variables
Initialization
Onbuild
Commands
Entrypoint
Configures a container that will run as an executable.
This will use shell processing to substitute shell variables, and will ignore any CMD
or docker run
command line arguments.
Metadata
See also
Basic example
Commands
Docker Command Cheat Sheet
Reference
Building
Ports
Commands
Environment variables
Docker Run Cheat Sheet Download
Dependencies
Other options
Advanced features
Labels
DNS servers
Devices
External links
Hosts
sevices
To view list of all the services runnning in swarm
To see all running services
to see all services logs
To scale services quickly across qualified node
clean up
To clean or prune unused (dangling) images
To remove all images which are not in use containers , add - a
To Purne your entire system
To leave swarm
To remove swarm ( deletes all volume data and database info)
To kill all running containers
Contributor -
Sangam biradar - Docker Community Leader
Docker is an increasingly popular tool designed to make it easier to create, deploy and run applications within a container. We recently published an article – Data Scientist guide for getting started with Docker – which hopefully laid out some of the basics. As we have done in the past with SQL, Python Regular Expressions and many others, we thought it would be useful to have a centralized cheat sheet for Docker commands, which we’ve based on Docker’s official cheat sheet:
Install
First off, you’ll need to head over to the Docker site to install a version of the software.
To ensure it’s been installed correctly, open the command line and type docker version. This should display something like the below:
Build
docker build [OPTIONS] PATH | URL | -
Common Options | Explanation |
--add-host | Add custom host-to-IP mapping (host:IP) |
--cache-from | Images to consider as cache sources |
--compress | Compress the build using gzip |
--file, -f | Name and route of Docker file |
--force-rm | Always remove intermediate containers |
--label | Set the metadata for the image |
--memory, -m | Set a memory limit |
--no-cahe | Do not use cache |
--rm | Remove intermediate containers after a successful build |
--tag, -t | Name and optionally tag an image in the ‘name:tag’ format |
--target | Set the target build stage |
Docker Run Cheat Sheet Excel
Builds an image from a Dockerfile
docker images
Lists all of the images that are locally stored in the docker engine
docker rmi IMAGE_NAME
Removes one or more images
Ship
docker pull IMAGE_NAME[:TAG]
Pulls an image or a repository from a registry
docker push IMAGE_NAME[:TAG]
Pushes an image or a repository to a registry
docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Creates a tag TARGET_IMAGE that refers to SOURCE_IMAGE
docker login [OPTIONS] [SERVER]
Common Options | Explanation |
--password, -p | Password |
--username, -u | Username |
Logs into a docker registry
docker logout [SERVER]
Logs out of a docker registry
Run
docker create [OPTIONS] IMAGE_NAME
Creates a new container. This is the same as docker run, but the container is never started. See docker run for options
docker run [OPTIONS] IMAGE_NAME
Common Options | Explanation |
--add-host | Add custom host-to-IP mapping (host:IP) |
--attach, -a | Attach to STDIN, STDOUT, STDERR |
--hostname, -h | Container host name |
--interactive, -i | Keep STDIN open even if not attached |
-it | Connect the container to the terminal |
--label, -l | Set metadata on the container |
--memory, -m | Set a memory limit |
--mount | Attach a filesystem mount to the container |
--name | Assign a name to the container |
--network | Connect a container to a certain network |
--publish, -p | Expose certain ports to the container |
--rm | Automatically remove the container when it exits |
--volume, -v | Bind mount a volume |
--workdir, -w | Set the working directory inside the container |
Run a command in a new container
docker start CONTAINER_NAME
Start one or more containers
docker stop CONTAINER_NAME
Stop one or more running containers
docker kill CONTAINER_NAME
Kill one or more running containers
docker ps
List all containers
docker rm CONTAINER_NAME
Remove one or more containers
Data Science Examples
FROM ubuntu
RUN apt-get install python3
This Dockerfile would install python3 on top of Ubuntu layer. Dockerfiles are text files that define the environment inside the container
Docker Run Cheat Sheet
This Dockerfile would:
- install python3 on top of Ubuntu layer
- create a /home/jupyter directory on the container
- copy in contents from the /src/jupyter folder on the user's machine
- Expose port 8000
- Run Jupyter notebook
docker pull tensorflow/tensorflow
Docker Compose Cheat Sheet
Pull a latest TensorFlow image down
docker run -it -p 8000:8000 tensorflow/tensorflow
Run TensorFlow image in a container on port 8000 Interesting factsthe biography of bernie mac.
Related: