2.1 Digital design tools on Linux or WSL using Docker

Table of contents

Install and start Docker service

1. Install docker service

Install docker by following the instruction here: https://docs.docker.com/engine/install/ubuntu/

This is the commands to install Docker in Ubuntu 22.04:

sudo apt-get install ca-certificates curl gnupg -q -y
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo   "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update -q
sudo apt-get install -q -y docker-ce docker-ce-cli containerd.io  docker-buildx-plugin docker-compose-plugin
cass@unic-cass:~$ sudo apt-get install ca-certificates curl gnupg -q -y
Reading package lists...
Building dependency tree...
Reading state information...
ca-certificates is already the newest version (20230311ubuntu0.22.04.1).
ca-certificates set to manually installed.
curl is already the newest version (7.81.0-1ubuntu1.16).
curl set to manually installed.
gnupg is already the newest version (2.2.27-3ubuntu2.1).
gnupg set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

cass@unic-cass:~$ sudo install -m 0755 -d /etc/apt/keyrings
cass@unic-cass:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
cass@unic-cass:~$ sudo chmod a+r /etc/apt/keyrings/docker.gpg
cass@unic-cass:~$ echo   "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

cass@unic-cass:~$ sudo apt-get update -q
Get:1 https://download.docker.com/linux/ubuntu jammy InRelease [48.8 kB]
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Get:4 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages [36.4 kB]
Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:6 http://security.ubuntu.com/ubuntu jammy-security InRelease
Fetched 85.3 kB in 1s (157 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...

cass@unic-cass:~$ sudo apt-get install -q -y docker-ce docker-ce-cli containerd.io  docker-buildx-plugin docker-compose-plugin
The following additional packages will be installed:
  docker-ce-rootless-extras libslirp0 pigz slirp4netns
Suggested packages:
  aufs-tools cgroupfs-mount | cgroup-lite
The following NEW packages will be installed:
  containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin libslirp0 pigz slirp4netns
0 upgraded, 9 newly installed, 0 to remove and 2 not upgraded.
Need to get 122 MB of archives.
After this operation, 436 MB of additional disk space will be used.
Get:1 https://download.docker.com/linux/ubuntu jammy/stable amd64 containerd.io amd64 1.7.19-1 [30.5 MB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/universe amd64 pigz amd64 2.6-1 [63.6 kB]
...
Get:9 https://download.docker.com/linux/ubuntu jammy/stable amd64 docker-compose-plugin amd64 2.29.0-1~ubuntu.22.04~jammy [12.5 MB]
Fetched 122 MB in 13s (9488 kB/s)
Selecting previously unselected package pigz.
(Reading database ... 44296 files and directories currently installed.)
Preparing to unpack .../0-pigz_2.6-1_amd64.deb ...
Unpacking pigz (2.6-1) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../1-containerd.io_1.7.19-1_amd64.deb ...
Unpacking containerd.io (1.7.19-1) ...
...
Selecting previously unselected package slirp4netns.
Preparing to unpack .../8-slirp4netns_1.0.1-2_amd64.deb ...
Unpacking slirp4netns (1.0.1-2) ...
Setting up docker-buildx-plugin (0.16.1-1~ubuntu.22.04~jammy) ...
Setting up containerd.io (1.7.19-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Setting up docker-compose-plugin (2.29.0-1~ubuntu.22.04~jammy) ...
...
Setting up docker-ce (5:27.1.0-1~ubuntu.22.04~jammy) ...
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.socket → /lib/systemd/system/docker.socket.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.8) ...
cass@unic-cass:~$ 
2. Start the docker service

If you use a real Linux system or a WSL Linux system with Systemd supported, you can start docker by running these commands:

sudo systemctl start docker
sudo systemctl enable docker
cass@unic-cass:~$ sudo systemctl start docker
cass@unic-cass:~$ sudo systemctl enable docker
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
3. Add user to docker group

You will also need to add your user to docker group so that you have permission to pull the docker image as normal users:

sudo gpasswd -a $USER docker
cass@unic-cass:~$ sudo gpasswd -a $USER docker
Adding user cass to group docker

To get the above command taking effect, you have to log out:

exit

After that, you can open a new shell and continue to the next section.

For WSL users without Systemd support

If your WSL Ubuntu 22.04 does not have Systemd support, you can still run Docker using System-V init script using the following command:

sudo service docker start