Detailed steps to install Docker17.12.0-ce in Ubuntu 16.04 environment

  For children's shoes who have never touched and installed Docker before, there should be many pits in the installation process, so here I will record and share my entire successful installation process, hoping to help friends in need. Next, we will introduce the specific installation and operation steps in detail~

 

1. Detect and uninstall docker and docker-engine so as not to affect subsequent installations

 

$ sudo apt-get remove docker docker-engine

  

2. Install docker's AUFS storage driver (if the Ubuntu system version is 14.04, it is recommended that users install it.)

 

$ sudo apt-get install \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual

  

3. Run the command to install the docker package

 

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

 

Note: If there are some strange dependency package errors here, it may be that some dependency packages are damaged. Run the following command to repair the installation package (this command is valid for ubuntu system)

 

$ sudo apt-get --fix-broken install #ubuntu command line fix install package

  

4. Add the official GPG key of docker

 

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

  

5. Set up a stable repository (stable stable version is released quarterly, Edge version is released monthly)

 

$ sudo add-apt-repository \
        "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
        $(lsb_release -cs) \
        stable"

Author: Dev_Mo
Link: https://www.jianshu.com/p/63191a548bf3
Source: Jianshu

  

6. Update the apt package

 

$ sudo apt-get update

  

7. Install docker ce

 

$ apt-get install docker-ce

  

8. Verify the docker installation result

 

$ sudo docker info
$ sudo docker version

  

9. Since the docker command needs to be run with sudo privileges every time, it is inconvenient to enter sudo every time. In order to facilitate adding the current user to the docker user group, there is no need to bother.

 

$ sudo usermod -aG docker ${USER}

  

Note: At this time, you need to log in to the system again to take effect, so you need to logout first and then log in

 

10. After re-login to the system, run the following command directly for verification. At this time, you can run the docker command without sudo.

 

$ docker version

 


  

11. Every time you use the docker pull command to pull an image, the docker daemon will go to Docker Hub to pull the image. The network speed is slow and even accessing Docker Hub in China sometimes encounters problems, so we can configure the image accelerator. The specific operations are as follows:

a, edit the configuration file
$ sudo gedit /etc/docker/daemon.json

b, enter the following configuration
{
 "registry-mirrors": ["https://obou6wyb.mirror.aliyuncs.com"]
}

c, save and exit

 

12. Restart the docker daemon

$ sudo service docker restart or
$ sudo systemctl restart docker or
$ sudo systemctl daemon-reload

 

13. Verify

$ docker run hello-world
# This command will go to Docker Hub to pull an image named hello-world, create and run a container from this image,
# Print Hello from Docker. If the mirror source acceleration is not configured, the pull speed may be very slow.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326104950&siteId=291194637