Recently, due to the needs of some automatic testing, a docker server environment needs to be installed. Check the official site of docker and find that whether it is windows, macos or liunx, the current official site recommends installing docker desktop. Hence, this article.
debian install
The installation of debian is not the focus of this article, and the installation process is omitted. When making UI selection, this article chooses KDE, because docker officially says that Gnome does not support an icon, so you need to install an extension. I think KDE support will be more perfect, so there should be fewer pits.
add sudo
After the default user installation, because it does not belong to the system administrator, it cannot install any software. At this point, we need to add our own non-root user to sudoer. Of course, maybe you can directly use root
to operate, I think it should be fine. In order to comply with international security practices, this article adopts the method of adding ordinary users to sudoer.
First we open the console:
Then enter the su -
command and enter the root password:
su -
command means: switch to the root user and use the current user's environment to prevent errors that some commands cannot be found due to the setting of $path after switching to root. For example:bash: usermod: command not found
Next, we add the current user to the sudo user group:
$ usermod -a -G sudo <username>
<xxx>
appears in some articles, indicating that the content in<xxx>
should be replaced with its actual value, such as the user name to be added in this articlepanjie
, then You need to replace the above command withusermod -a -G sudo panjie
Next, we log out of the current user and choose to log in again.
At this point, the current user is already the sudo user.
set proxy (optional)
Please refer to: https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-set-the-proxy-for-apt-for-ubuntu-18-04/
Install QEMU
Next, we install the QEMU related packages according to the solution given by the QEMU official website :
$ sudo apt install qemu qemu-utils qemu-system-x86 qemu-system-gui
It should be noted that if you are also using the DVD program, you may encounter: Media change: please insert thid disc labeled 'Debin GNU/xxxx' xxx in the driver '/media/cdrom/' and press [Enter].
prompt.
There are two solutions:
- Re-mount the system DVD disk (this should not be the only installation method), execute the above command again to complete the installation of QEMU, and then proceed to the operation of canceling the CD source in this article. This is also how this article uses it in the actual installation.
- According to the operation of canceling the CD source in this article, execute the above command again to complete the installation of QEMU. This method should be no problem in principle, but it has not been verified.
After the installation is complete, execute: qemu-img --help
, if a prompt message appears, the installation is successful (no error is reported during the installation process, but if the prompt cannot find qemu-img, you can try to log out and log in again).
The version number is 5.2.0, which meets the official minimum requirements.
Cancel CD source
After installing QEMU, we still hope that other software can be installed directly from the Internet. At this time, we need to disable the CD source.
In KDE we do this in sequence:
other request
In addition to the operating system version, CPU version, virtualization support, QEMU, KDE desktop environment and not less than 4G memory requirements, docker desktop also has certain requirements for ID mapping (ID mapping). Fortunately, after confirming that we installed debian11 The operating system meets this requirement by default, and the confirmation steps are as follows:
$ echo $USER
username
$ cat /etc/subuid
username:100000:65536
$ cat /etc/subgid
username:100000:65536
Note: username is our current username, such as panjie
in this article.
install docker desktop
Finally, we can officially start the installation. In order to avoid stepping on the pit, we also refer to the official installation tutorial at this time.
install gnome-termial
Since this article uses KDE UI, you need to install gnome-terminal
:
$ sudo apt install gnome-terminal
If you are using gnome UI, according to the official statement, you need to install AppIndicator
and KStatusNotifierItem
two Gnome extensions.
Set up docker repository
Also refer to the official tutorial to set up the docker package repository.
$ sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
$ sudo mkdir -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker Engine
In fact, it should be noted that if the purpose of running docker is to perform related tests, then this Docker Engine is what we need. That is to say, there is no need to install the graphical Docker Desktop. Then along with the ones that don't need to be installed: UI (Gnome or KDE) and QEMU.
Since the purpose of this article is to introduce how to install Docker Desktop, and during the installation of Docker Desktop, Docker Engine is automatically installed, so this part is not required in this article.
Download the latest package
Open a browser in debian and visit: https://docs.docker.com/desktop/install/debian/
Click to download to the Downloads
folder.
install package
After the download is complete, go to the folder where you downloaded the file, this article is Downloads, and execute the following command:
$ cd ~/Downloads
$ sudo apt-install update
$ sudo apt-get install ./docker-desktop-<version>-<arch>.deb
<version>-<arch>
according to the file name you actually downloaded
At this point, a series of operations will be performed automatically and wait for completion.
According to the official statement, after the installation is complete, 3 scripts will be automatically executed:
One of them is to add a k8s DNS point to /etc/hosts
, so we can also use the method of viewing the /etc/hosts
file to confirm whether the installation is successful:
Start Docker Desktop
Re-open a new termial, and then execute the systemctl --user enable docker-desktop
command, you can successfully start Docerk Desktop!
$ systemctl --user enable docker-desktop
As with the start command type, the command to stop Docker Desktop is:
$ systemctl --user stop docker-desktop
Then unfortunately overturned, docker-desktop has been stopped in the stopped state.
Then this article uses systemctl --user status docker-desktop | more
to view the final error reason:
Google did not find a useful effect, so: start to uninstall the current 4.11.0 version and install a specified 4.8.2 version.
If you are lucky enough not to roll over, then you can continue reading Self-starting
Auto-start
uninstall
First we stop docker:
$ systemctl --user stop docker-desktop
Then execute the uninstall command:
$ sudo apt remove docker-desktop
Download 4.8.2
Also use the browser in debian to open the official website: https://docs.docker.com/desktop/
Then click on the Release menu:
Find 4.8.2 again, click Debian to download the file.
Then continue with the previous installation process:
Then there is the related error.
give up!
Just install Docker Engine
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。