Docker notes
18 Nov 2018- What docker is
- What docker does
- Why docker better.
docker images
docker ps
docker images
docker ps --format $FORMAT
docker container
docker ps
format
docker ps --format $FORMAT
$ docker ps --format "table \t"
CONTAINER ID MOUNTS
fced780016e2 /Users/duan.li…,/Users/duan.li…
$ docker ps --format "table \t"
CONTAINER ID MOUNTS
fced780016e2 /Users/duan.li…,/Users/duan.li…
$ docker ps --format ""
fced780016e2
docker ps --format ": "
fced780016e2: "php -S 0.0.0.0:8000…"
docker ps --format "table \t"
CONTAINER ID LABELS
fced780016e2 org.label-schema.schema-version== 1.0 org.label-schema.name=CentOS Base Image org.label-schema.vendor=CentOS org.label-schema.license=GPLv2 org.label-schema.build-date=20180531
Placeholder | Description |
---|---|
.ID | Container ID |
.Image | Image ID |
.Command | Quoted command |
.CreatedAt | Time when the container was created. |
.RunningFor | Elapsed time since the container was started. |
.Ports | Exposed ports. |
.Status | Container status. |
.Size | Container disk size. |
.Names | Container names. |
.Labels | All labels assigned to the container. |
.Label | Value of a specific label for this container. For example ‘’ |
.Mounts | Names of the volumes mounted in this container. |
.Networks | Names of the networks attached to this container. |
docker run
- -it
- -d
- –rm
- –memory
- –cpu-shares
- –cpu-quota
docker exec
exec vs run vs start
- start: start one or more stopped containers
- exec: run a command in a running container
- run create a container from image