1. Introduction

What is Docker? What are the advantages and disadvantages? There is a lot of information on the Internet.

2. Environment information

  • Ubuntu18.04 LTS

Method for viewing the system version number

uname -aLinux dell PowerEdge - R440 5.0.0-37 - generic#40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Copy the code

3. Installation procedure

No matter at what time, the official documents or the most authoritative, other people’s experience of course can make people take a lot of detours, but still have to develop the habit of reading official documents

3.1 Check before installation

You can check one by one against the official website. Mine is a new machine, so there is no need to do additional checks. Let’s get straight to the point

3.2 Comparison between the two Installation modes

There are two ways to install Docker in Ubuntu

  • Apt way
  • Download files and install them

Among them, apt is the easiest way to install, which can be manually typed into a few commands. However, because Docker image server is abroad, I used apt-get install directly without any image accelerator configuration for the first time, and the waiting time was quite long. So I am here to recommend a friend door directly download the image file to install, file download address poke me, please select xenial/pool/stable/amd64, need to download the three files, can be uploaded to the server after the download is complete, need to download the file below:

Ll - RW-RW-r -- 1 surging all states Docker-ce_19.03.3-0_ubuntu-xenial_amd64. deb-rw-RW-r -- 1 Surging all states Docker - ce - cli_19. 03.9 _3-0 _ubuntu - xenial_amd64. DebCopy the code

Install containerd.io_1.2.6-3_amd64.deb, docker-CE-cli_19.03.9 -0_ubuntu-xenial_amd64.deb, and docker-ce_19.03.9 -0_ubuntu-xenia in sequence l_amd64.deb

Sudo DPKG -i containerd.io_1.2.6-3_amd64.deb Is selecting the unselected containerd.io package. Reading database... The system currently has 205,848 files and directories installed. Preparing to unpack containerd.io_1.2.6-3_amd64.deb... Unpacking containerd.io (1.2.6-3)... Setting up containerd.io (1.2.6-3)... Created symlink/etc/systemd/system/multi - user. Target. Wants/containerd. Service - > / lib/systemd/system/containerd. Service.Copy the code
Sudo DPKG -i docker-ce-cli_19.03.93-0_ubuntu-xenial_amd64. deb Is selecting the unselected package docker-ce-cli. Reading database... The system currently has 205,869 files and directories installed. Docker-ce-cli_19.03.93-0_ubuntu-xenial_amd64.deb... Docker-ce-cli (5:19.03.9~3-0~ Ubuntu-Xenial)... Setting docker-CE-CLI (5:19.03.9~3-0~ Ubuntu-Xenial)... Processing triggers for MAN-DB (2.4.3-2Ubuntu0.1)...Copy the code
Sudo DPKG -i docker-ce_19.03.93-0_ubuntu-xenial_amd64. deb sudo DPKG -i docker-ce_19.03.93-0_ubuntu-xenial_amd64. deb The system currently has 206,074 files and directories installed. Docker-ce_19.03.93-0_ubuntu-xenial_amd64.deb... Is unpacking docker-CE (5:19.03.9~3-0~ Ubuntu-xenial) into (5:19.03.9~3-0~ Ubuntu-xenial)... Setting docker-CE (5:19.03.9~3-0~ Ubuntu-Xenial)... Created symlink/etc/systemd/system/multi - user. Target. Wants/docker. Service - > / lib/systemd/system/docker. Service. Created Symlink/etc/systemd/system/sockets). Target wants/docker. The socket - > / lib/systemd/system/docker. The socket. Processing triggers for Systemd (237-3 Ubuntu10.38)... Processing trigger for ureadAhead (0.100.0-21)...Copy the code

Then Docker is installed, is not nanfu super simple, never change from its native Hello-world, go you!

sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9
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 whichruns 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/
Copy the code

Copyright statement: this article is entirely original, with the record, if the infringement please contact me to delete!

Docker handy notes 2 – configuring ali mirror accelerator, based on Ubuntu18.04LTS