I want to install CanvasLMS for testing it. Docker is one of assumption for CanvasLMS.
Note
Getting docker document at github says install from docker.io for canvas-lms. Following instruction is install from docker that I happened to install (Add: 2021.5.11)
0 Environment
Canvas LMS requires 8GB RAM, 150GB storage according to github.com/instructure/canvas-lms
Mine is Ubuntu on an little old Macbook Air - 2015 model.
1
2
3
4
5
6
|
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
|
1 Setup the repository
I checked docker documentation - Install Docker Engine on Ubuntu and followed “install using repository”.
Update the apt package index and install packages to allow apt to use a repository over HTTPS:
1
2
3
4
5
6
7
8
|
$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
|
Add Docker’s official GPG key:
1
|
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
Verify finger print
1
2
3
4
5
|
$ 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) <docker@docker.com>
sub rsa4096 2017-02-22 [S]
|
You can see if Docker official key is added to apt-key manager:
1
2
3
4
5
6
|
$ apt-key list
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <docker@docker.com>
sub rsa4096 2017-02-22 [S]
...
|
What is fingerprint? - Ref. Wikipedia - nPublic key fingerprint
In public-key cryptography, a public key fingerprint is a short sequence of bytes used to identify a longer public key. Fingerprints are created by applying a cryptographic hash function to a public key. Since fingerprints are shorter than the keys they refer to, they can be used to simplify certain key management tasks.
Setup stable repository
1
2
3
4
|
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
|
2 Install Docker Engine
Update the apt package index, and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
1
2
|
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
|
To install a specific version of Docker Engine, list the available versions in the repo, then select and install it by sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
1
|
$ apt-cache madison docker-ce
|
Check whether docker installed successfully. See Hello World.
2.1. Error : “Docker service is masked”
Docker service is masked
If docker does not work with error like:
1
|
Failed to start docker.service: Unit docker.service is masked.
|
then you should try:
1
2
3
|
$ systemctl unmask docker.service
$ systemctl unmask docker.socket
$ systemctl start docker.service
|
2.2. Error : “Cannot connect to Docker”
Cannot connect to Docker
If you cannot connect to docker with error like:
1
2
3
4
5
6
7
8
9
10
11
|
● docker.service - LSB: Create lightweight, portable, self-sufficient containers.
Loaded: loaded (/etc/init.d/docker; generated)
Active: failed (Result: exit-code) since Fri 2021-03-26 13:22:22 JST; 17s ago
Docs: man:systemd-sysv-generator(8)
Process: 6344 ExecStart=/etc/init.d/docker start (code=exited, status=1/FAILURE)
3月 26 13:22:22 ubuntu01 systemd[1]: Starting LSB: Create lightweight, portable, self-sufficient containers....
3月 26 13:22:22 ubuntu01 docker[6344]: * /usr/bin/dockerd not present or not executable
3月 26 13:22:22 ubuntu01 systemd[1]: docker.service: Control process exited, code=exited status=1
3月 26 13:22:22 ubuntu01 systemd[1]: docker.service: Failed with result 'exit-code'.
3月 26 13:22:22 ubuntu01 systemd[1]: Failed to start LSB: Create lightweight, portable, self-sufficient containe
|
After I tried re-install docker with updated packages, it worked.
1
2
3
4
5
|
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
$ systemctl unmask docker.service
$ systemctl unmask docker.socket
$ systemctl start docker.service
|
3. Installed docker version
1
2
|
$ sudo docker --version
Docker version 20.10.5, build 55c4c88
|
More detail:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
$ sudo docker version
Client: Docker Engine - Community
Version: 20.10.5
API version: 1.41
Go version: go1.13.15
Git commit: 55c4c88
Built: Tue Mar 2 20:18:05 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.5
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 363e9a8
Built: Tue Mar 2 20:16:00 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.4
GitCommit: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
runc:
Version: 1.0.0-rc93
GitCommit: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
docker-init:
Version: 0.19.0
GitCommit: de40ad0
|
4. Hello world
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
$ sudo docker run hello-world
[sudo] password for xxx:
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/
|
5. Post Installation (Add 2021.05.12)
Ref.
5.1. Manage Docker as Non-root user
Create docker group
Add user to Docker group
1
|
$ sudo usermod -aG docker $USER
|
Activate the change to group
Then you can run docker
command without sudo.
1
|
$ docker run hello-world
|
1
2
|
$ sudo systemctl enable docker.service
$ sudo systemctl enable containerd.service
|
If you want to disable it, change enable to disable.
1
2
|
$ sudo systemctl disable docker.service
$ sudo systemctl disable containerd.service
|
References