Install Docker in a newly installed virtual machine Ubuntu 22.04 LTS
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
wangqiang@wangqiang-virtual-machine:~$ curl -fssl https://get.docker.com | SH CommandcurlNot found, but can be installed with: sudo apt install curl wangqiang@wangqiang-virtual-machine:~$ sudo apt install curl [sudo]Password for wangqiang: Reading a list of packages... Done Analyzing the dependency tree of the package... Done Reading status information... complete The following software will be installed at the same time: libcurl4 The following [New] packages will be installed: curl The following packages will be upgraded: libcurl4 Upgraded 1 package, 1 new package was installed, 0 packages were to be uninstalled, and 212 packages were not upgraded. A 484 KB archive is required to be downloaded. Extra space will consume 458 KB after decompression. Do you want to continue executing?[Y/n]y Get: 1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libcurl4 amd64 7.81.0-1ubuntu1.3[290 kB] Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 curl amd64 7.81.0-1ubuntu1.3[194 kB] Downloaded 484 KB, 4 seconds (109 KB/s) (The database is being read ... The system currently has 179838 files and directories installed.) Ready to decompress.../libcurl4_7.81.0-1ubuntu1.3_amd64.deb ... decompressing libcurl4:amd64 (7.81.0-1ubuntu1.3) and overwriting (7.81.0-1ubuntu1.1) ... Unselected package curl is being selected. Ready to decompress .../curl_7.81.0-1ubuntu1.3_amd64.deb ... Unzipping curl (7.81.0-1ubuntu1.3) ... Setting libcurl4:amd64 (7.81.0-1ubuntu1.3) ... Setting curl (7.81.0-1ubuntu1.3) ... Processing triggers for MAN-DB (2.10.2-1) ... Processing triggers for 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: 10c12954828e7c7c9b6ea9b0c02b01407d3ae1 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, considering 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 grow non-root Users access, refer to https://docs.docker.com/go/daemon-access/ Warning: access to the remote api on a priority To root access on the host. Refer to theDocker 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
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
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, which is Why weRe 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: 10c12954828e7c7c9b6ea9b0c02b01407d3ae1 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, considering 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 grow non-root Users access, refer to https://docs.docker.com/go/daemon-access/ Warning: access to the remote api on a priority To root access on the host. Refer to theDocker 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
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
root@wangqiang-virtual-machine:~# sudo passwd -u root Passwd: Password Expiry Information Changed. root@wangqiang-virtual-machine:~#
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
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
8. Configure to enable the Docker service to start automatically. as shown in Figure 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
root@wangqiang-virtual-machine:~# Docker info client: Context: default Debug mode: False Plugins: App: Docker App (Docker Inc., v0.9.1-beta3) BuildX: Docker BuildX (Docker Inc., v0.8.2-Docker) Compose: Docker Compose (Docker Inc., V2.6.0) Scan: Docker Scan (Docker Inc., v0.17.0) Server: containers: 0 running: 0 paused: 0 Stopped: 0 images: 0 Server version: 20.10.17 Storage Driver: Overlay2 backing filesystem: extfs support d_type: true Native Overlay Diff: False UserXattr: False Logging driver: json-file cgroup driver: systemd cgroup version: 2 Plugins: volume: local NETWORK: Bridge Host ipvlan macvlan null overlay Logentries splunk syslog swarm: inactive runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc default runtime: runc Init Binary: Docker-Init Containerd Version: 10C12954828E7C7C9B6E0EA9B0C02B01407D3AE1 runc version: v1.1.2-0-ga916309 init version: de40ad0 Security options: AppArmor seccomp Profile: default cgroups Kernel Version: 5.15.0-1012-Azure Operating System: Ubuntu 22.04 LTS ostype: linux Architecture: x86_64 cpus: 2 Total Memory: 4.268gib Name: wangqiang-virtual-machine ID: mrxg:6oll:evdb:i5ax:y4uk:gdol:scul:lemv:z6gi:j6ar:j26m:6qpz docker root dir: /var/lib/docker Debug mode: False registry: https://index.docker.io/v1/ Labels: Experimental: False Insecure registries: 127.0.0.0/8 Live Restore Enabled: False








