Docker Tutorial
Docker Installation
How to use Docker
Docker Instance
Docker Container Lifecycle Command
Docker Container Operation Command
Docker Container rootfs Command
Docker Mirror Repository Command
Docker Local Image Management Command
Docker info|version Command
Docker supports the following Debian versions:
Docker Engine-Community is supported on x86_64 (or amd64) armhf, and arm64 architectures.
The installation command is as follows:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
Older versions of Docker were called docker, docker.io or docker-engine, if installed, uninstall them:
$ sudo apt-get remove docker docker-engine docker.io containerd runc
Before installing Docker Engine-Community for the first time on a new host, you need to set up the Docker repository. After that, you can install and update Docker from the repository.
Raspbian users cannot use this method!
For Raspbian, installing using repositories is not yet supported. You must use the shell script mode instead.
Update the apt package index.
$ sudo apt-get update
Install apt dependencies for fetching repositories over HTTPS.
$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg2 \ software-properties-common
Add Docker's official GPG key: 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88. Verify that you now have the key with the fingerprint by searching for the last 8 characters of the fingerprint.
$ sudo apt-key fingerprint 0EBFCD88 pub 4096R/0EBFCD88 2017-02-22 Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid Docker Release (CE deb) <docker@docker.com> sub 4096R/F273FCD8 2017-02-22
Update the apt package index:
$ sudo apt-get update
Install the latest versions of Docker Engine-Community and containerd, or go to the next step to install a specific version:
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Install a specific version using a version string, such as 5:18.09.1~3-0~debian-stretch.
$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
To test whether Docker is successfully installed, enter the following command and print the following information to indicate that the installation is successful:
$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f 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://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
Remove the installation package:
sudo apt-get purge docker-ce
Delete images, containers, configuration files, etc.:
sudo rm -rf /var/lib/docker