-
Docker Engine contains
- A long running server (Daemon process)
- REST API to interact with daemon
- A command line interface client for using REST commands (Docker Client)
- Daemon creates/manages Docker objects (images, containers, networks, data)
- Daemon and Docker Client can be on same machine or different machines.
- Client talks to Daemon via REST API.
-
Docker Objects
- Docker Images
- read only template for creating Docker Containers.
- Described in a text file called dockerfile.
- Docker Containers
- runnable instance of a Docker image
- Docker Registeries
- library of Docker Images
- can be public/private on same server as Daemon or Client or totally separate server
- Docker Swarm services
- Docker Images
docker [OPTIONS] COMMAND [arg...]
Root | OPTIONS | Use |
---|---|---|
docker run [OPTIONS] IMAGE [COMMAND] [ARG...] |
-a,c,d,e,h,i,l,m,p,P,t,u,v,w |
create and start a container |
docker create [OPTIONS] IMAGE [COMMAND] {ARG...] |
-a,c,e,h,i,l,m,p,P,t,u,v,w |
create but do not start a container |
docker rename OLD_NAME NEW_NAME |
rename a container | |
docker rm [OPTIONS] CONTAINER [CONTAINER...] |
-f,l,v |
remove one or more containers |
docker start [OPTIONS] CONTAINER [CONTAINER...] |
-a,i |
start one or more stopped containers |
docker stop [OPTIONS] CONTAINER [CONTAINER...] |
-t |
stop one or more running containers |
docker pause CONTAINER [CONTAINER...] |
pause all processes within one or more containers | |
docker unpause CONTAINER [CONTAINER...] |
unpause all processes within one or more containers | |
docker kill [OPTIONS] CONTAINER [CONTAINER...] |
-s |
kill one or more running containers |
docker attach [OPTIONS] CONTAINER |
attach to a running container |
Command | OPTIONS | Use |
---|---|---|
docker ps [OPTIONS] |
-a,f,n,l,q,s |
show runnings containers |
docker top CONTAINER [ps OPTIONS] |
display the running processes of a container | |
docker stats [OPTIONS] [CONTAINER] |
-a |
display a live stream of container(s) resource usage stats |
docker diff CONTAINER |
show changes on a container's filesystem | |
docker port CONTAINER |
Command | OPTIONS | Use |
---|---|---|
docker export [OPTIONS] CONTAINER |
-o |
export a container's filesystem as a tar archive |
`docker import [OPTIONS] file | URL | - [REPOSITORY[:TAG]]` |
docker images [OPTIONS] [REPOSITORY[:TAG]] |
-a,f,q |
list images |
`docker build [OPTIONS] PATH | URL | -` |
docker rmi [OPTIONS] IMAGE [IMAGE...] |
-f |
remove one or more images |
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] |
-a,c,m,p |
create a new image from a container's changes |
docker save [OPTIONS] IMAGE [IMAGE...] |
-o |
save one or more images to a tar archive (streamed to STDOUT by default) |
docker load [OPTIONS] |
-i,q |
load an image from a tar archive or STDIN |
docker history [OPTIONS] IMAGE |
-H,q |
show the history of an image |
docker tag IMAGE[:TAG] IMAGE[:TAG] |
Tag an image into a repository |