1. Open: Terminal, one-click installation, execute the command: curl –fssl https://get.docker.com | SH. During the prompt that curl is not found, execute: sudo apt install curl. as shown in Figure 1
Figure 1
wangqiang@wangqiang-Virtual-Machine:~$ curl -fsSL https://get.docker.com | sh
Command 'curl' not found, but can be installed with:
sudo apt install curl
wangqiang@wangqiang-Virtual-Machine:~$ sudo apt install curl
[sudo] password for wangqiang:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
将会同时安装下列软件:
libcurl4
下列【新】软件包将被安装:
curl
下列软件包将被升级:
libcurl4
升级了 1 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 212 个软件包未被升级。
需要下载 484 kB 的归档。
解压缩后会消耗 458 kB 的额外空间。
您希望继续执行吗? [Y/n] Y
获取:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libcurl4 amd64 7.81.0-1ubuntu1.3 [290 kB]
获取:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 curl amd64 7.81.0-1ubuntu1.3 [194 kB]
已下载 484 kB,耗时 4秒 (109 kB/s)
(正在读取数据库 ... 系统当前共安装有 179838 个文件和目录。)
准备解压 .../libcurl4_7.81.0-1ubuntu1.3_amd64.deb ...
正在解压 libcurl4:amd64 (7.81.0-1ubuntu1.3) 并覆盖 (7.81.0-1ubuntu1.1) ...
正在选中未选择的软件包 curl。
准备解压 .../curl_7.81.0-1ubuntu1.3_amd64.deb ...
正在解压 curl (7.81.0-1ubuntu1.3) ...
正在设置 libcurl4:amd64 (7.81.0-1ubuntu1.3) ...
正在设置 curl (7.81.0-1ubuntu1.3) ...
正在处理用于 man-db (2.10.2-1) 的触发器 ...
正在处理用于 libc-bin (2.35-0ubuntu3) 的触发器 ...
wangqiang@wangqiang-Virtual-Machine:~$ curl -fsSL https://get.docker.com | sh
# Executing docker install script, commit: b2e29ef7a9a89840d2333637f7d1900a83e7153f
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sudo -E sh -c mkdir -p /etc/apt/keyrings && chmod -R 0755 /etc/apt/keyrings
+ sudo -E sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
+ sudo -E sh -c chmod a+r /etc/apt/keyrings/docker.gpg
+ sudo -E sh -c echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable" > /etc/apt/sources.list.d/docker.list
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-scan-plugin >/dev/null
+ version_gte 20.10
+ [ -z ]
+ return 0
+ sudo -E sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce-rootless-extras >/dev/null
+ sudo -E sh -c docker version
Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:02:46 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:00:51 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309
docker-init:
Version: 0.19.0
GitCommit: de40ad0
================================================================================
To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:
dockerd-rootless-setuptool.sh install
Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.
To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/
WARNING: Access to the remote API on a privileged Docker daemon is equivalent
to root access on the host. Refer to the 'Docker daemon attack surface'
documentation for details: https://docs.docker.com/go/attack-surface/
================================================================================
2. To run Docker as a non-privileged user, consider setting up a Docker daemon with rootless mode for your user to install: dockerd-rootless-setuptool.sh installation. Visit https://docs.docker.com/go/rootless/ for rootless mode. An alternative to root login, if you want to work on the root console, you can also use sudo -i. as shown in Figure 2
Figure 2
wangqiang@wangqiang-Virtual-Machine:~$ sudo -i
[sudo] password for wangqiang:
root@wangqiang-Virtual-Machine:~#
3. Execute the command again: curl –fssl https://get.docker.com | sh. Still reporting: warning. as shown in Figure 3
Figure 3
root@wangqiang-Virtual-Machine:~# curl -fsSL https://get.docker.com | sh
# Executing docker install script, commit: b2e29ef7a9a89840d2333637f7d1900a83e7153f
Warning: the "docker" command appears to already exist on this system.
If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.
If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.
You may press Ctrl+C now to abort this script.
+ sleep 20
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c mkdir -p /etc/apt/keyrings && chmod -R 0755 /etc/apt/keyrings
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
+ sh -c chmod a+r /etc/apt/keyrings/docker.gpg
+ sh -c echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-scan-plugin >/dev/null
+ version_gte 20.10
+ [ -z ]
+ return 0
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce-rootless-extras >/dev/null
+ sh -c docker version
Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:02:46 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:00:51 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309
docker-init:
Version: 0.19.0
GitCommit: de40ad0
================================================================================
To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:
dockerd-rootless-setuptool.sh install
Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.
To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/
WARNING: Access to the remote API on a privileged Docker daemon is equivalent
to root access on the host. Refer to the 'Docker daemon attack surface'
documentation for details: https://docs.docker.com/go/attack-surface/
================================================================================
root@wangqiang-Virtual-Machine:~#
4. To run Docker as a non-privileged user, consider setting up a Docker daemon for rootless mode for your user to install: dockerd-rootless-setuptool.sh installation. Visit https://docs.docker.com/go/rootless/ for rootless mode. Decided to switch to root user login. as shown in Figure 4
Figure 4
root@wangqiang-Virtual-Machine:~# sudo passwd root
New password:
Retype new password:
passwd: password updated successfully
5. Unlock the account, execute the command: sudo passwd -u root, success. as shown in Figure 5
Figure 5
6. Enable the enhancement session, log in again as root, the login is successful, open: terminal, the user defaults to: root. as shown in Figure 6
Figure 6
7. Execute the command: curl –fssl https://get.docker.com | sh, still report: warning. This issue is ignored for the time being. as shown in Figure 7
Figure 7
8. Configure to enable the Docker service to start automatically. as shown in Figure 8
8
root@wangqiang-Virtual-Machine:~# 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
root@wangqiang-Virtual-Machine:~# systemctl start docker
root@wangqiang-Virtual-Machine:~#
9. Execute: Docker Info, view relevant information. Confirm that the installation is complete. as shown in Figure 9
Figure 9
Leave a Reply