|
docker --help
|
Displays basic help options and commands
|
|
docker <command> --help
|
Display detailed help for a specific command
|
|
docker ps
|
List of "live" containers
|
|
docker ps -a/-all
|
List of all containers
|
|
docker version
|
Display docker versioning
|
|
docker run <image>
|
Builds a docker image from the Docker file
|
|
docker run [options] <image:tag@digest> <command> <arguments>
|
Full syntax of docker run command
|
|
docker create <image>:<tag>
|
Creates a container using the image
|
|
docker start <container>
|
Starts a container
|
|
docker stop <container>
|
Stops a container in an orderly manner
|
|
docker kill <container>
|
Immediately stops a running container
|
|
docker restart <container>
|
Restarts a stopped container
|
|
docker rm <container>
|
Removes a stopped container
|
|
docker port <container>
|
Lists the port mapping of a "running" container
|
|
docker images
|
List images
|
|
docker run <image>:<tag>
|
Builds a new container using the image
|
|
docker build <image>:<tag>
|
Builds a docker image from the Docker file
|
|
docker rmi <image>:<tag>
|
Remove an image (not attached to a container)
|
|
docker save <image>:<tag>
|
Saves an image to a tar archive
|
|
docker push <image>:<tag>
|
Pushes the image to Docker Hub
|
|
docker pull <image>:<tag>
|
Pulls the image from Docker Hub
|
|
docker exec -it <container> <entrypoint>
|
Executes the command or terminal of a running container
|
|
docker inspect <image or container>
|
Returns low level information on an image or a container
|
|
docker attach <container>
|
Attach to a running container
|
|
-i, --interactive
|
Keep STDIN open even if not attached
|
|
-t, --tty
|
Allocate a psuedo-TTY
|
|
-it
|
Combines the -i and the -t options (interactive response)
|
|
-a, --attach
|
attach
|
|
-d, --detach
|
Run in background
|
|
-e, --env
|
Set ENV variables
|
|
exec
|
Run a new command in a container (See Misc)
|
|
-p, -publish <host_port>>:<container_port>
|
Port mapping (Host to container)
|
|
-v, --volume <source>:<target>
|
Mount files or directories (terse)
|
|
-m, --mount
|
Mount files or directores (verbose)
|
|
--name=<name>
|
Assigns a name to a container: docker run --name=<name> <image>
|
|
-a, --all
|
Adds the option of "all" to the container list: docker ps -a
|
|
sh
|
Entrypoint command for a shell in a container: docker run -it <image> sh or docker exec -it <container> sh
|
|
docker volume ls
|
List volumes
|
|
docker volume inspect
|
Inspect a volume
|
|
docker volume create <volume>
|
Create a volume
|
|
docker volume rm <volume>
|
Removes a volume
|
|
FROM <image> [AS <name>]
|
Sets the base image for this layered imaged
|
|
RUN <command>
|
(Shell form) Executes commands in a new layer
|
|
RUN ["executable", "param1", "param2"]
|
(Exec form) Executes commands in a new layer
|
|
CMD ["executable", "param1", "param2"]
|
(Exec form) Sets default executable as the ENTRYPOINT
|
|
CMD ["param1", "param2"]
|
(adds default parameters to non-specified ENTRYPOINT)
|
|
CMD command param1 param2
|
(shell form)
|
|
LABEL <key>=<value> <key>=<value> ...
|
Adds metadata to an image
|
|
EXPOSE <port> [<ports>/<protocol>]
|
Specifys the port(s) for the container to listen on
|
|
ENV <key>=<value
|
Sets an environment variable for all subsequent instructions
|
|
COPY [--chown=<usr>:<group>] <src>... <dest>
|
Copies files or directorys from <src> and adds them to the container at <dest>
|
|
VOLUME ["/data"]
|
(Can be an array) Creates a mount point for files or directories
|
|
USER <user>[:<group>]
|
Sets the user name and optionally the user group to use when running image
|
|
WORKDIR
|
Sets the working directory
|
|
ARG <NAME>=<value>
|
ARG is the only command that may precede the FROM command. It sets support variables for the FROM
|
|
From <image>
|
|
WORKDIR <path>
|
|
[ENV <key>=<value>]
|
|
COPY <src> <target>
|
|
RUN command param1 param2 ...
|
|
CMD ["executable", "param1", "param2", ...]
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.