Difference between revisions of "Docker"
(128 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | [[wikipedia:Docker_(software)|Docker]] is a software available since 2013 | + | [[wikipedia:Docker_(software)|Docker]] is a software utility to pack, ship and run any [[container]]s application available since March [[2013]]. |
+ | * [[Google trends]]: https://trends.google.com/trends/explore?date=all&q=Docker | ||
+ | * <code>[[docker --help]]</code> | ||
== Features == | == Features == | ||
Docker offer the following features: | Docker offer the following features: | ||
* Package an application and its dependencies in a virtual container that can run on any Linux server ([[docker images]]) | * Package an application and its dependencies in a virtual container that can run on any Linux server ([[docker images]]) | ||
− | * Pull or push [[docker images]] to a [[container repository]]/container registry (<code>[[docker pull]]</code><ref>https://docs.docker.com/engine/reference/commandline/pull/</ref>, <code>[[docker push]]</code>). By default docker hub but you can specify any other registry. | + | * Pull or push [[docker images]] to a [[container repository]]/[[container registry]] (<code>[[docker pull]]</code><ref>https://docs.docker.com/engine/reference/commandline/pull/</ref>, <code>[[docker push]]</code>). By default docker hub but you can specify any other registry. |
== Installing Docker == | == Installing Docker == | ||
Line 10: | Line 12: | ||
On macOS you can follow official documentation https://docs.docker.com/docker-for-mac/install/ which requires to create and account to download installer. You can also try: | On macOS you can follow official documentation https://docs.docker.com/docker-for-mac/install/ which requires to create and account to download installer. You can also try: | ||
− | <code>brew cask install docker</code> or try to follow https://pilsniak.com/how-to-install-docker-on-mac-os-using-brew/ instructions: | + | <code>[[brew cask install docker]]</code> or try to follow https://pilsniak.com/how-to-install-docker-on-mac-os-using-brew/ instructions: |
: <code>brew install docker [[docker-compose]] docker-machine</code>(to install docker and docker-compose) | : <code>brew install docker [[docker-compose]] docker-machine</code>(to install docker and docker-compose) | ||
: <code>brew cask install virtualbox</code> | : <code>brew cask install virtualbox</code> | ||
Line 17: | Line 19: | ||
: <code>docker-machine env default</code> | : <code>docker-machine env default</code> | ||
: <code>eval $(docker-machine env default)</code> | : <code>eval $(docker-machine env default)</code> | ||
− | : <code>[[ | + | : <code>[[docker run]] hello-world</code> (will pull hello-world image and run it on docker) |
− | + | === Ubuntu === | |
+ | * <code>[[apt install docker.io]]</code> | ||
+ | * <code>[[snap]] install docker</code> (officially provided by [[Canonical]]) | ||
=== Binaries === | === Binaries === | ||
− | Following binaries will be installed: <code>docker-init</code>, <code>[[docker-proxy]]</code>, <code>docker</code> and <code>dockerd</code> | + | Following binaries will be installed: <code>[[docker-init]]</code>, <code>[[docker-proxy]]</code>, <code>docker</code> and <code>[[dockerd]]</code> |
=== Verifying Docker installation === | === Verifying Docker installation === | ||
Once installed the Docker [[Daemon (computing)|daemon]], called <code>"dockerd"</code> should be running. | Once installed the Docker [[Daemon (computing)|daemon]], called <code>"dockerd"</code> should be running. | ||
− | You can also run <code>[[ | + | You can also run <code>[[docker run]] hello-world</code> to verify docker correct installation. |
=== Configuration files === | === Configuration files === | ||
− | + | Ubuntu: | |
+ | * <code>[[/etc/docker/daemon.json]]</code> (Ref: https://docs.docker.com/engine/reference/commandline/dockerd/) | ||
+ | * <code>/etc/docker/[[key.json]]</code> | ||
+ | |||
+ | === Directories === | ||
+ | [[/var/lib/docker/]] (The Docker daemon was explicitly designed to have exclusive access to)<ref>https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/</ref> | ||
== Docker Releases ([[Docker Engine release notes]]) == | == Docker Releases ([[Docker Engine release notes]]) == | ||
Line 42: | Line 51: | ||
Some typical task using containers: | Some typical task using containers: | ||
− | + | == Docker verification commands == | |
* Verify correct installation: <code>[[docker run]] hello-world</code> | * Verify correct installation: <code>[[docker run]] hello-world</code> | ||
You will see some message similar to this one: | You will see some message similar to this one: | ||
Line 74: | Line 83: | ||
</pre> | </pre> | ||
− | + | == Docker image and container creation == | |
− | * Create a new docker image base on ''alpine'' linux distribution and login into the new container: <code>[[ | + | * Create a new [[docker image]] base on ''alpine'' linux distribution and login into the new container: <code>[[docker run]] -it alpine sh</code> |
− | * Create a new docker image: <code>docker build</code> | + | * Create a new docker image: <code>[[docker build]]</code> |
− | ** Create a new docker image by creating a new text file with instructions, usually called <code>[[ | + | ** Create a new docker image by creating a new text file with instructions, usually called <code>[[Dockerfile]]</code><ref>https://docs.docker.com/engine/reference/builder/</ref>: <code>docker build -f /path/to/a/Dockerfile .</code> |
− | * Create a container: <code>docker create</code> | + | * Create a container: <code>[[docker create]]</code> |
* Generate a mediawiki:1.27 image: <code>docker build --tag mediawiki:1.27 .</code> (you can use -t or --tag) | * Generate a mediawiki:1.27 image: <code>docker build --tag mediawiki:1.27 .</code> (you can use -t or --tag) | ||
* Execute or run a container based on mediawiki:1.27 image: <code>docker run --name wikiFGA -p 0.0.0.0:9090:80 -d mediawiki:1.27</code> | * Execute or run a container based on mediawiki:1.27 image: <code>docker run --name wikiFGA -p 0.0.0.0:9090:80 -d mediawiki:1.27</code> | ||
− | + | == Docker Container Operation == | |
− | * '''Start''' an existing container: <code>[[docker start]] CONTAINER_ID OR CONTAINER_NAME</code>. See also [[ | + | * '''Start''' an existing container: <code>[[docker start]] CONTAINER_ID OR CONTAINER_NAME</code>. See also <code>[[docker run]]</code> and differences<ref>https://stackoverflow.com/questions/34782678/difference-between-running-and-starting-a-docker-container</ref> and <code>[[docker container start]]</code> |
* '''Stop''' an running container: <code>docker stop container_id</code> | * '''Stop''' an running container: <code>docker stop container_id</code> | ||
* '''Show''' only running containers: | * '''Show''' only running containers: | ||
− | ** <code>docker container ls</code> <ref>https://docs.docker.com/engine/reference/commandline/container_ls/</ref> or <code>[[ | + | ** <code>[[docker container ls]]</code> <ref>https://docs.docker.com/engine/reference/commandline/container_ls/</ref> or <code>[[docker ps]]</code> <ref>https://docs.docker.com/engine/reference/commandline/ps/</ref>. (<code>[[docker container]] ls</code>) introduced in 2017 in [[Docker 1.13]]<ref>https://www.docker.com/blog/whats-new-in-docker-1-13/</ref> (There is no difference between both commands)<ref>https://stackoverflow.com/a/45254760</ref> |
* '''Show''' containers (running or not): | * '''Show''' containers (running or not): | ||
− | ** <code>docker ps -a </code>: https://docs.docker.com/engine/reference/commandline/ps/ | + | ** <code>[[docker ps]] -a </code>: https://docs.docker.com/engine/reference/commandline/ps/ |
** <code>docker container ls -a </code>. See also <code>[[docker-compose]] ps</code> | ** <code>docker container ls -a </code>. See also <code>[[docker-compose]] ps</code> | ||
− | * '''Login | + | * '''Login'''/[[Connect into a running container]]: |
− | ** <code>[[ | + | ** <code>[[docker exec]]<ref>https://docs.docker.com/engine/reference/commandline/exec/</ref> -it <my_container_name> bash</code> |
** <code>docker exec -it <my_container_name> sh</code> | ** <code>docker exec -it <my_container_name> sh</code> | ||
+ | ** <code>[[docker run]] -it --user USER_NAME CONTAINER_NAME</code> | ||
* '''Start''' stopped containers: <code>docker start $(docker ps -a -q -f status=exited)</code> | * '''Start''' stopped containers: <code>docker start $(docker ps -a -q -f status=exited)</code> | ||
− | * '''Restart''' all containers: <code>docker restart $(docker ps -aq)</code> previously <code>docker restart $(docker ps -q)</code><code>-a all -q quiet</code><ref>https://stackoverflow.com/questions/38221463/command-for-restarting-all-running-docker-containers</ref> | + | * '''Restart''' all containers: <code>[[docker restart]] $(docker ps -aq)</code> previously <code>docker restart $(docker ps -q)</code><code>-a all -q quiet</code><ref>https://stackoverflow.com/questions/38221463/command-for-restarting-all-running-docker-containers</ref> |
+ | |||
+ | * [[Start configuration behavior and restart policy]]<ref>https://docs.docker.com/config/containers/start-containers-automatically/#use-a-restart-policy</ref> | ||
− | * [[ | + | * <code>[[docker container update]]</code> |
+ | * <code>[[docker kill]]</code> | ||
− | See also: [[docker compose]] and <code>docker stack</code> | + | See also: <code>[[docker compose]]</code> and <code>[[docker stack]]</code> |
− | == | + | == [[Docker images management]] == |
− | + | {{docker images TOC}} | |
− | |||
− | |||
− | |||
=== Docker Network command line commands === | === Docker Network command line commands === | ||
− | + | {{docker network TOC}} | |
− | * <code>docker network | + | * <code>docker network -rm</code> |
− | |||
=== Docker resource limitation === | === Docker resource limitation === | ||
− | * Limit container '''CPU''' usage to 0.5 cpus: <code> docker run -it --cpus=".5" docker_image /bin/bash</code> | + | * Limit container '''CPU''' usage to 0.5 cpus: <code>[[docker run]] -it --cpus=".5" docker_image /bin/bash</code> |
− | * Limit memory requires your kernel to have functionality activated, you can check it executing<code>[[docker info]]</code>. See https://docs.docker.com/install/linux/linux-postinstall/ and [[docker-compose]] resource limitation example: [[ | + | * Limit [[memory]] requires your kernel to have functionality activated, you can check it executing<code>[[docker info]]</code>. See https://docs.docker.com/install/linux/linux-postinstall/ and [[docker-compose]] resource limitation example: [[Version 3 resouces]] |
=== Docker: Working with remote repositories/registries === | === Docker: Working with remote repositories/registries === | ||
− | You will be using mainly the following commands <code>[[docker login]]</code>, <code>docker logout</code>, <code>[[ | + | You will be using mainly the following commands <code>[[docker login]]</code>, <code>[[docker logout]]</code>, <code>[[docker pull]]</code> and <code>docker push</code>. Docker registry allow to configure notifications. <ref>https://docs.docker.com/registry/notifications/</ref>. Docker has a public repository called Docker Hub and cloud providers offer repositories services such as AWS Elastic Container Registry (ECR). |
=== Docker Information === | === Docker Information === | ||
* <code>[[docker version]]</code> https://docs.docker.com/engine/reference/commandline/version/ | * <code>[[docker version]]</code> https://docs.docker.com/engine/reference/commandline/version/ | ||
* <code>[[docker info]]</code> https://docs.docker.com/engine/reference/commandline/info/ | * <code>[[docker info]]</code> https://docs.docker.com/engine/reference/commandline/info/ | ||
− | * <code>[[docker stats]]</code> | + | * <code>[[docker stats]]</code> https://docs.docker.com/engine/reference/commandline/stats/ |
− | * <code>[[ | + | * <code>[[docker system info]]</code> https://docs.docker.com/v17.12/edge/engine/reference/commandline/system_info/ |
* <code>docker system events</code> https://docs.docker.com/v17.12/edge/engine/reference/commandline/system_events/ | * <code>docker system events</code> https://docs.docker.com/v17.12/edge/engine/reference/commandline/system_events/ | ||
− | * <code>docker system df</code> | + | * <code>[[docker system df]]</code> |
− | * <code> docker top [CONTAINER_NAME or CONTAINER_ID]</code> https://docs.docker.com/engine/reference/commandline/top/ | + | * <code>[[docker top]][CONTAINER_NAME or CONTAINER_ID]</code> https://docs.docker.com/engine/reference/commandline/top/ |
* <code>[[docker inspect]] CONTAINER_ID|IMAGE_ID</code><ref>http://manpages.ubuntu.com/manpages/disco/man1/docker-inspect.1.html</ref> https://docs.docker.com/engine/reference/commandline/inspect/ also available for: container, image, volume, network, node, service, or task | * <code>[[docker inspect]] CONTAINER_ID|IMAGE_ID</code><ref>http://manpages.ubuntu.com/manpages/disco/man1/docker-inspect.1.html</ref> https://docs.docker.com/engine/reference/commandline/inspect/ also available for: container, image, volume, network, node, service, or task | ||
− | * <code>[[ | + | * <code>[[docker images]]</code>, <code>[[docker images]] -q</code> |
− | * <code>[[ | + | * <code>[[docker image inspect]]</code><ref>https://docs.docker.com/engine/reference/commandline/image_inspect/</ref> |
− | * <code>[[ | + | * <code>[[docker image ls]]</code> or <code>[[docker image ls]] --no-trunc </code> |
+ | * <code>[[docker volume ls]]</code> | ||
+ | * <code>[[docker history]] IMAGE</code> | ||
+ | * <code>[[docker ps]]</code> | ||
=== Docker Operation === | === Docker Operation === | ||
− | * <code>[[ | + | * <code>[[docker run]]<ref>https://docs.docker.com/engine/reference/run/</ref> IMAGE|IMAGE_ID </code>: https://docs.docker.com/engine/reference/run/ |
− | * <code>[[ | + | * <code>[[docker start]] CONTAINER_ID|CONTAINER_NAME</code>: https://docs.docker.com/engine/reference/commandline/start/ |
− | * <code>[[ | + | * <code>[[docker stop]] CONTAINER_ID|CONTAINER_NAME</code>: https://docs.docker.com/engine/reference/commandline/stop/ |
− | * <code>[[ | + | * <code>[[docker restart]] CONTAINER_ID|CONTAINER_NAME</code>: https://docs.docker.com/engine/reference/commandline/restart/ |
=== Docker/[[cgroup]] Performance information === | === Docker/[[cgroup]] Performance information === | ||
* <code>[[systemd-cgtop]]</code> | * <code>[[systemd-cgtop]]</code> | ||
− | === Docker Swarm === | + | === [[Docker Swarm]] === |
− | * <code>[[docker | + | {{docker swarm TOC}} |
− | + | * <code>[[docker service create]]</code> | |
=== Maintenance === | === Maintenance === | ||
− | * <code>[[ | + | * <code>[[docker system prune]] -a</code> remove unused and dangling images. Therefore any images being used in a container, whether they have been exited or currently running, will NOT be affected.<ref>https://stackoverflow.com/a/45143234</ref>. See also: <code>[[docker system info]]</code> |
+ | |||
+ | === [[Docker Volumes]] === | ||
+ | {{docker volumes}} | ||
− | + | Related terms: [[Bind Mounts]] | |
− | |||
− | |||
− | |||
− | |||
− | == | + | === Secrets === |
− | + | * <code>[[docker secrets]]</code> (Feb 2017)<ref>https://www.docker.com/blog/docker-secrets-management/</ref> ([[swarm]] mode only) | |
− | |||
− | |||
− | |||
− | |||
− | * | ||
− | |||
− | |||
− | |||
− | == | + | == [[Docker logging]] == |
+ | |||
+ | == Related terms== | ||
* <code>[[DevOps/Docker/docker tag|docker tag]]</code><ref>https://docs.docker.com/engine/reference/commandline/tag/</ref> | * <code>[[DevOps/Docker/docker tag|docker tag]]</code><ref>https://docs.docker.com/engine/reference/commandline/tag/</ref> | ||
+ | * <code>[[docker registry]]</code> | ||
+ | * [[OverlayFS]] | ||
+ | * [[Docker Enterprise]] (2017) | ||
+ | * [[Docker Desktop on Windows]] ~ 500 MB | ||
+ | * [[Benjamin Golub]] | ||
+ | * [[Docker download rate limit]] <ref>https://docs.docker.com/docker-hub/download-rate-limit/</ref> | ||
+ | * [[Docker Swarm]], [[Docker Scout]] | ||
+ | * <code>[[crane]]</code> tool for interacting with [[remote images]] and [[registries]]. | ||
+ | * [[systemctl restart]] | ||
== Activities == | == Activities == | ||
# Read docker blog: https://blog.docker.com/ | # Read docker blog: https://blog.docker.com/ | ||
− | # Read [[ | + | # Read [[Docker Engine release notes]] (2017) and [[Docker CE]] or [[Docker EE]] releases. |
− | # Understand the difference between an image and a container, Docker Images vs. Containers: https://stackoverflow.com/a/26960888 | + | # Understand the difference between an [[docker image|image]] and a container, Docker Images vs. Containers: https://stackoverflow.com/a/26960888 |
− | # Understand the difference between <code>[[ | + | # Understand the difference between <code>[[docker start]]</code> and <code>[[docker run]]</code>: https://stackoverflow.com/questions/34782678/difference-between-running-and-starting-a-docker-container. See also [[runC]] |
# Read Stackoverflow questions related to docker: https://stackoverflow.com/questions/tagged/docker?tab=Votes | # Read Stackoverflow questions related to docker: https://stackoverflow.com/questions/tagged/docker?tab=Votes | ||
# Read about Docker Image Manifest Version 2, Schema 2: https://github.com/docker/distribution/blob/fda42e5ef908bdba722d435ff1f330d40dfcd56c/docs/spec/manifest-v2-2.md | # Read about Docker Image Manifest Version 2, Schema 2: https://github.com/docker/distribution/blob/fda42e5ef908bdba722d435ff1f330d40dfcd56c/docs/spec/manifest-v2-2.md | ||
+ | # Duplicate and image using <code>[[docker commit]]</code> command | ||
+ | * [[Create and manage access tokens]] | ||
== See also == | == See also == | ||
+ | * {{docker cmd}} | ||
* {{Docker}} | * {{Docker}} | ||
− | * | + | * {{Dockerd}} |
− | * | + | * {{docker-compose}} |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{CC license}} | {{CC license}} | ||
Source: https://en.wikiversity.org/wiki/DevOps/Docker | Source: https://en.wikiversity.org/wiki/DevOps/Docker | ||
− | + | [[Category:Docker]] | |
− | + | [[Category:Linux containers]] | |
− | |||
− | [[Category: | ||
− | [[Category: |
Latest revision as of 14:50, 29 August 2024
Docker is a software utility to pack, ship and run any containers application available since March 2013.
Contents
Features[edit]
Docker offer the following features:
- Package an application and its dependencies in a virtual container that can run on any Linux server (docker images)
- Pull or push docker images to a container repository/container registry (
docker pull
[1],docker push
). By default docker hub but you can specify any other registry.
Installing Docker[edit]
You can read official Docker documentation about installing Docker on your system: https://docs.docker.com/install/.
On macOS you can follow official documentation https://docs.docker.com/docker-for-mac/install/ which requires to create and account to download installer. You can also try:
brew cask install docker
or try to follow https://pilsniak.com/how-to-install-docker-on-mac-os-using-brew/ instructions:
brew install docker docker-compose docker-machine
(to install docker and docker-compose)brew cask install virtualbox
docker-machine create --driver virtualbox default
docker-machine ls
docker-machine env default
eval $(docker-machine env default)
docker run hello-world
(will pull hello-world image and run it on docker)
Ubuntu[edit]
apt install docker.io
snap install docker
(officially provided by Canonical)
Binaries[edit]
Following binaries will be installed: docker-init
, docker-proxy
, docker
and dockerd
Verifying Docker installation[edit]
Once installed the Docker daemon, called "dockerd"
should be running.
You can also run docker run hello-world
to verify docker correct installation.
Configuration files[edit]
Ubuntu:
/etc/docker/daemon.json
(Ref: https://docs.docker.com/engine/reference/commandline/dockerd/)/etc/docker/key.json
Directories[edit]
/var/lib/docker/ (The Docker daemon was explicitly designed to have exclusive access to)[2]
Docker Releases (Docker Engine release notes)[edit]
Use: docker version
[3] to check your version.
You can download Docker CE source code from GitHub[4].
Docker Command Line[edit]
You can read official docker command line documentation in https://docs.docker.com/engine/reference/commandline/docker/. Before being able to run docker commands you will have to install Docker on your machine.
Some typical task using containers:
Docker verification commands[edit]
- Verify correct installation:
docker run hello-world
You will see some message similar to this one:
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world ca4f61b1923c: Pull complete Digest: sha256:97ce6fa4b6cdc0790cda65fe7290b74cfebd9fa0c9b8c38e979330d547d22ce1 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/
Docker image and container creation[edit]
- Create a new docker image base on alpine linux distribution and login into the new container:
docker run -it alpine sh
- Create a new docker image:
docker build
- Create a new docker image by creating a new text file with instructions, usually called
Dockerfile
[5]:docker build -f /path/to/a/Dockerfile .
- Create a new docker image by creating a new text file with instructions, usually called
- Create a container:
docker create
- Generate a mediawiki:1.27 image:
docker build --tag mediawiki:1.27 .
(you can use -t or --tag) - Execute or run a container based on mediawiki:1.27 image:
docker run --name wikiFGA -p 0.0.0.0:9090:80 -d mediawiki:1.27
Docker Container Operation[edit]
- Start an existing container:
docker start CONTAINER_ID OR CONTAINER_NAME
. See alsodocker run
and differences[6] anddocker container start
- Stop an running container:
docker stop container_id
- Show only running containers:
docker container ls
[7] ordocker ps
[8]. (docker container ls
) introduced in 2017 in Docker 1.13[9] (There is no difference between both commands)[10]
- Show containers (running or not):
docker ps -a
: https://docs.docker.com/engine/reference/commandline/ps/docker container ls -a
. See alsodocker-compose ps
- Login/Connect into a running container:
docker exec[11] -it <my_container_name> bash
docker exec -it <my_container_name> sh
docker run -it --user USER_NAME CONTAINER_NAME
- Start stopped containers:
docker start $(docker ps -a -q -f status=exited)
- Restart all containers:
docker restart $(docker ps -aq)
previouslydocker restart $(docker ps -q)
-a all -q quiet
[12]
See also: docker compose
and docker stack
Docker images management[edit]
- List created images:
docker images
[14],docker image ls
(both commands seems to perform the same action, note it is image instead of images) - Images are stored in
docker info | grep "Docker Root Dir"
[15] docker image rm
[16]. See also:docker rm CONTAINER
docker rmi IMAGE_ID
Docker Network command line commands[edit]
docker network ls
docker network inspect NETWORK_NAME
- Deprecated:
docker --link
[17] docker network create NETWORK_NAME
docker network rm
docker network prune
docker network connect
docker network -rm
Docker resource limitation[edit]
- Limit container CPU usage to 0.5 cpus:
docker run -it --cpus=".5" docker_image /bin/bash
- Limit memory requires your kernel to have functionality activated, you can check it executing
docker info
. See https://docs.docker.com/install/linux/linux-postinstall/ and docker-compose resource limitation example: Version 3 resouces
Docker: Working with remote repositories/registries[edit]
You will be using mainly the following commands docker login
, docker logout
, docker pull
and docker push
. Docker registry allow to configure notifications. [18]. Docker has a public repository called Docker Hub and cloud providers offer repositories services such as AWS Elastic Container Registry (ECR).
Docker Information[edit]
docker version
https://docs.docker.com/engine/reference/commandline/version/docker info
https://docs.docker.com/engine/reference/commandline/info/docker stats
https://docs.docker.com/engine/reference/commandline/stats/docker system info
https://docs.docker.com/v17.12/edge/engine/reference/commandline/system_info/docker system events
https://docs.docker.com/v17.12/edge/engine/reference/commandline/system_events/docker system df
docker top[CONTAINER_NAME or CONTAINER_ID]
https://docs.docker.com/engine/reference/commandline/top/docker inspect CONTAINER_ID|IMAGE_ID
[19] https://docs.docker.com/engine/reference/commandline/inspect/ also available for: container, image, volume, network, node, service, or taskdocker images
,docker images -q
docker image inspect
[20]docker image ls
ordocker image ls --no-trunc
docker volume ls
docker history IMAGE
docker ps
Docker Operation[edit]
docker run[21] IMAGE|IMAGE_ID
: https://docs.docker.com/engine/reference/run/docker start CONTAINER_ID|CONTAINER_NAME
: https://docs.docker.com/engine/reference/commandline/start/docker stop CONTAINER_ID|CONTAINER_NAME
: https://docs.docker.com/engine/reference/commandline/stop/docker restart CONTAINER_ID|CONTAINER_NAME
: https://docs.docker.com/engine/reference/commandline/restart/
Docker/cgroup Performance information[edit]
Docker Swarm[edit]
docker swarm init
docker swarm
[22]docker nodes
docker node ls
docker swarm join
docker service create
Maintenance[edit]
docker system prune -a
remove unused and dangling images. Therefore any images being used in a container, whether they have been exited or currently running, will NOT be affected.[23]. See also:docker system info
Docker Volumes[edit]
docker volume create --name VOLUME_NAME
docker volume ls
: https://docs.docker.com/engine/reference/commandline/volume_ls/docker volume rm VOLUME_NAME
docker volume
: https://docs.docker.com/engine/reference/commandline/volume/docker volume inspect VOLUME
: https://docs.docker.com/engine/reference/commandline/volume_inspect/docker inspect -f '{{ .Mounts }}' CONTAINER_NAME
docker volumes prune
docker system prune --volumes
Related terms: Bind Mounts
Secrets[edit]
docker secrets
(Feb 2017)[24] (swarm mode only)
Docker logging[edit]
Related terms[edit]
docker tag
[25]docker registry
- OverlayFS
- Docker Enterprise (2017)
- Docker Desktop on Windows ~ 500 MB
- Benjamin Golub
- Docker download rate limit [26]
- Docker Swarm, Docker Scout
crane
tool for interacting with remote images and registries.- systemctl restart
Activities[edit]
- Read docker blog: https://blog.docker.com/
- Read Docker Engine release notes (2017) and Docker CE or Docker EE releases.
- Understand the difference between an image and a container, Docker Images vs. Containers: https://stackoverflow.com/a/26960888
- Understand the difference between
docker start
anddocker run
: https://stackoverflow.com/questions/34782678/difference-between-running-and-starting-a-docker-container. See also runC - Read Stackoverflow questions related to docker: https://stackoverflow.com/questions/tagged/docker?tab=Votes
- Read about Docker Image Manifest Version 2, Schema 2: https://github.com/docker/distribution/blob/fda42e5ef908bdba722d435ff1f330d40dfcd56c/docs/spec/manifest-v2-2.md
- Duplicate and image using
docker commit
command
See also[edit]
docker
[config | pull
|push
|run
|start
, |stop
|cp
|events
|info
|version
|build
|commit
|image
|images
|image ls
|image inspect
|rmi
|rm
|tag
|exec | rename | manifest | save | service update | load
],docker --help
- Docker:
docker-compose
, Docker Desktop, Docker Scout, Docker Swarm, Docker Volumes, Docker images management, docker network,docker inspect
,docker volume inspect
,Dockerfile
, Docker Engine release notes,docker kill
,moby
, Docker-in-Docker,docker context
,buildx
,docker tag
,docker system prune
, Docker Hub,hub-tool, /etc/docker/daemon.json
,hostconfig.json
, dockerd, logs, Docker logging, Backup,docker service
,depends on
,--dns, --filter
,--mount
,docker login
,docker build
,apt remove docker.io
,.dockerignore
, docker context ls |docker-machine, .docker/
, PWD,$HOME/.docker/config.json
, Docker ID,--env-file, docker --help
- Docker: dockerd, docker (command), dockerd-ce (dockerd), docker-proxy, Docker Kubernetes Service (DKS),
/var/lib/docker/, /var/run/docker.sock
, 9323, /etc/docker/daemon.json docker-compose
,docker-compose.yml
: [services
|volumes
|networks
|up
|down
|restart
|logs
|create
|changelog
|version
|secrets
|config
|-v
|-h
|exec], docker-compose pull
,Environment:
, Docker-compose.yml examples,.env
, release notes, expose:, docker-compose --env-file,services.deploy.resources
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.
Source: https://en.wikiversity.org/wiki/DevOps/Docker
- ↑ https://docs.docker.com/engine/reference/commandline/pull/
- ↑ https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/
- ↑ https://docs.docker.com/engine/reference/commandline/version/
- ↑ https://github.com/docker/docker-ce/releases
- ↑ https://docs.docker.com/engine/reference/builder/
- ↑ https://stackoverflow.com/questions/34782678/difference-between-running-and-starting-a-docker-container
- ↑ https://docs.docker.com/engine/reference/commandline/container_ls/
- ↑ https://docs.docker.com/engine/reference/commandline/ps/
- ↑ https://www.docker.com/blog/whats-new-in-docker-1-13/
- ↑ https://stackoverflow.com/a/45254760
- ↑ https://docs.docker.com/engine/reference/commandline/exec/
- ↑ https://stackoverflow.com/questions/38221463/command-for-restarting-all-running-docker-containers
- ↑ https://docs.docker.com/config/containers/start-containers-automatically/#use-a-restart-policy
- ↑ https://docs.docker.com/engine/reference/commandline/images/
- ↑ https://stackoverflow.com/questions/19234831/where-are-docker-images-stored-on-the-host-machine
- ↑ https://docs.docker.com/engine/reference/commandline/image_rm/
- ↑ https://docs.docker.com/network/links/
- ↑ https://docs.docker.com/registry/notifications/
- ↑ http://manpages.ubuntu.com/manpages/disco/man1/docker-inspect.1.html
- ↑ https://docs.docker.com/engine/reference/commandline/image_inspect/
- ↑ https://docs.docker.com/engine/reference/run/
- ↑ <https://docs.docker.com/engine/reference/commandline/swarm/
- ↑ https://stackoverflow.com/a/45143234
- ↑ https://www.docker.com/blog/docker-secrets-management/
- ↑ https://docs.docker.com/engine/reference/commandline/tag/
- ↑ https://docs.docker.com/docker-hub/download-rate-limit/
Advertising: