Install Docker on Ubuntu Server 20.04

environment

Put Docker in a virtual machine (Ubuntu Server 20.04) running on macOS. Basically, put it as described in the Official Guide.

By the way, the reason why you shouldn't put Docker directly on your Mac is [it seems that it is notorious that "Docker for Mac is slow!"](Https://www.google.com/search?q=mac+docker+%E9% 81% 85% E3% 81% 84 & oq = mac + docker + & aqs = chrome.2.69i57j0l7.2424j0j7 & sourceid = chrome & ie = UTF-8).

procedure

In my case, using SSH tonga (guest OS host name) and bali (also guest OS host name I connected to .com / hajime-f / items / ea34a38a405f48b1ce65) and did the following (Reference: Use the computer while thinking about the southern island -f / items / 2c10db500bc40d1f8e29)))

Repository settings

Update the package index with update, then make apt available to the repository over HTTPS.

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

Then add the official Docker GPG Key (https://xtech.nikkei.com/it/article/Keyword/20091204/341579/) to apt.

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

Let's check if the fingerprint is correct. It is OK when `` `9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88``` is displayed as shown below.

$ sudo apt-key fingerprint 0EBFCD88

pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <[email protected]>
sub   rsa4096 2017-02-22 [S]

Then add the stable repository to apt.

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

Install Docker CE

Install the latest version of Docker CE and containerd. Don't forget to update as we added the repository earlier.

$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io

Run the Hello World container and you should see something like the following:

$ sudo docker run hello-world
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/

A simple translation is as follows.

Welcome to Docker!
If you see this message, your installation is successful.

To print this message, Docker takes the following steps:
1.The Docker client connects to the Docker daemon.
2.Docker daemon from DockerHub"hello-world"Get the image.
3.The retrieved image runs the executable that produces the output you are looking at,
The Docker daemon creates a new container from this image.
4.The Docker daemon passes this output to the Docker client and
The Docker client sends this output to your terminal.

I'm not sure what it is, but in short, the Docker client, which is the interface with the user, communicates with the Docker daemon, and the Docker daemon creates a container from the specified image and runs it, and shows the result via the client. Is that the place?

Make Docker available to general users

If you have successfully installed Docker, you should have a Docker group, so check that first.

$ cat /etc/group | grep docker
docker:x:998:

Add yourself to the "docker" group.

$ sudo usermod -aG docker hajime-f

If you log in again, you should be able to run `` `$ docker run hello-world``` without sudo.

Install Docker Compose

Download the stable version of Docker Compose from GitHub.

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" \
>    -o /usr/local/bin/docker-compose

Grant execute permission to Docker Compose.

$ sudo chmod +x /usr/local/bin/docker-compose

Good grief. Now you can finally use Docker. Next, let's write in the Dockerfile and play with it.

I played ... "Building a development environment for Django + MySQL + nginx with Docker Compose"

Recommended Posts

Install Docker on Ubuntu Server 20.04
Install Ubuntu Server 20.04 on Btrfs
Install pyqt5 on ubuntu
Install Docker on Manjaro
Install Ruby on Ubuntu 20.04
Install Autoware on Ubuntu 18.04.5
Install Homebrew on Ubuntu 20.04
Install Docker on Raspberry Pi
Install Docker on Windows 10 PRO
Install OpenJDK7 (JAVA) on ubuntu 14.04
Build VNC Server on Ubuntu 20.04
Install Cybozu Office 10 on Ubuntu 20.4
Oracle Java 8 on Docker Ubuntu
Install zabbix agent (5.0) on Ubuntu 18.04
Install MAV Proxy on Ubuntu 18.04
Install Arudino IDE on Ubuntu 20
Install Java on WSL Ubuntu 18.04
Install Ubuntu Desktop 20.10 on RaspberryPi4
Install Arduino IDE on Ubuntu 20.04
Install raspi-config on Ubuntu 20.04 (LTS)
Install docker on AWS EC2
Install WordPress 5.5 on Ubuntu 20.04 LTS
Install PlantUML on Intellij on Ubuntu
Note: Install PostgreSQL 9.5 on Ubuntu 18.04
Install openjdk8 on Docker image (Debian)
Install Docker on AWS Ubunt 20.04 LTS
Install java with Ubuntu 16.04 based Docker
Install AWS IoT Greengrass on Ubuntu
Install JDK and JRE on Ubuntu 16.10
Install ngrok on ubuntu16.04 using Vagrant
How to install WildFly on Ubuntu 18.04
Install MQTT broker Mosquitto on Ubuntu 18.04
Install SonarQube on ECS instance on Ubuntu 16.04
Install ruby on Ubuntu 20.04 with rbenv
The key to running Docker on Raspberry Pi 4 (Ubuntu server 20.04)
Install docker and docker-compose on ubuntu in the shortest process
Liberty on Docker
I tried running Docker on Windows Server 2019
Headless install of Ubuntu 20.10 on Raspberry Pi
Run NordVPN on Docker (Windows) Ubuntu container
Install OpenJDK (Java) on the latest Ubuntu
Use docker in proxy environment on ubuntu 20.04.1
How to install production Metabase on Ubuntu
I want to install PHP 7.2 on Ubuntu 20.04.
Install Realtek network driver on Ubuntu Note
Microservices 101-I tried putting Docker on Ubuntu-
Try putting Docker in ubuntu on WSL
Until you run apache on ubuntu on docker
Run Ubuntu + ROS with Docker on Mac
Install Ubuntu Server 20.04 in VirtualBox on Mac and connect with SSH
tmux on Ubuntu
Redmine on Docker
Install Docker on Ubuntu and set up remote connection using tls
Wine settings on Ubuntu 18.04 (install WOLF RPG Editor)
Build and install Wireshark Development Release (3.3.1) on Ubuntu
Install Ubuntu Core 18 on Raspberry Pi 2 Model B
Just install Laravel8 on docker in PHP8 environment
Install Docker on Raspberry Pi 4 and Raspberry Pi OS 64bit
How to install network drivers on standalone Ubuntu
Radiko recording server on Raspberry Pi 4 (Docker unused)
How to install NVIDIA driver on Ubuntu 18.04 (Note)