Docker on Ubuntu 20.04LTS Quick Start Guide

06/30/2020Docker,InfrastructureDocker,Ubuntu

Install Ubuntu to virtual box.

1-1. Download and Install Ubuntu.


Install some applications and change OS settings.

2-1. Install ssh.

$ sudo apt-get install openssh-server

2-2. Install curl.

$ sudo apt install curl

2-3. Install git.

$ sudo apt install git

2-4 Change prompt. (Optional)

Edit “.bashrc" file and add the following line.

export PS1="[\u@\h \W]\$ "


Install Docker to Ubuntu

3-1 Download a shell script that can install docker from “https://get.docker.com/“.

$ curl -fsSL https://get.docker.com -o get-docker.sh

3-2 Execute the downloaded shell script.

$ sh get-docker.sh

3-3 Add user to the “docker" group. (Optional)

If you would like to use Docker as a non-root user, you should now consider
adding your user to the “docker" group with something like:

$ sudo usermod -aG docker user1

3-4 Check docker version.

$ sudo docker version

If you see the version information like below, installation is completed.

[root@demo docker]$ docker version
Client: Docker Engine - Community
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213ff
Built: Mon Jun 22 15:45:44 2020
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213ff
Built: Mon Jun 22 15:44:15 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3229
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9bea36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3682



Install Docker Machine

4-1. Execute the latest installation command.

Visit the docker website “https://docs.docker.com/machine/install-machine/" and get the latest command of installation. Because the version in the command would be changed.

$ base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
sudo mv /tmp/docker-machine /usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine

4-2. Check Docker Machine’s version.

$ docker-machine version
docker-machine version 0.16.0, build 702c267f



Install Docker Compose

5-1. Execute the latest installation command.

You can get the installation command at the following both site.

If you want to know details about the docker compose, docs.docker.com is good. But if you want to get the latest docker compose, GitHub is better.

Before you execute the following command, change the version to the appropriate one.

curl -L https://github.com/docker/compose/releases/download/1.26.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

5-2. Check Docker Compose version.

$ docker-compose version
docker-compose version 1.26.0, build d4451659
docker-py version: 4.2.1
CPython version: 3.7.7
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019

All set. Docker Machine and Docker Compose are installed under /usr/local/bin.

$ cd /usr/local/bin
$ ls
docker-compose docker-machine