Install the latest Docker under Ubuntu 18.04
docker installation
Prerequisites for installation
Docker requires the kernel version of the Ubuntu system to be higher than 3.10 and 64-bit.
// 查看ubuntu内核版本
root@zc:~# uname -a
//查看ubuntu版本
root@zc:~# lsb_release -a
Uninstall the old version of docker
root@zc:~# sudo apt-get remove docker docker-engine docker.io
Update system software
root@zc:~# sudo apt-get update
Install dependencies
root@zc:~# sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
Add the official secret key When
executing this command, if there is no response for a long time, it means that the network cannot connect to the docker website, and you need to use a proxy to do it.
root@zc:~# sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add warehouse
root@zc:~# sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Update the system software again
root@zc:~# sudo apt-get update
Install docker
//如果想指定安装某一版本,可使用 sudo apt-get install docker-ce={VERSION} 命令,把{VERSION}替换为具体版本即可。
//以下命令没有指定版本,默认就会安装最新版
root@zc:~# sudo apt-get install docker docker.io
View docker version
root@zc:~# docker -v
docker-compose installation
docker-compse: can run and manage multiple docker containers.
Download docker-compose
//参见:https://github.com/docker/compose/releases
root@zc:~# sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
Authorization
root@zc:~# sudo chmod +x /usr/local/bin/docker-compose
View version information
root@zc:~# docker-compose --version
docker-machine installation
docker-machine: The docker management tool officially provided by docker. It can manage multiple docker hosts and build swarm clusters.
Install virtualBox
The use of docker-machine is based on virtualBox. If it has not been installed, please install virtualBox first.
Log in to the official website of virtualBox: https://www.virtualbox.org/wiki/Linux_Downloads
Author's version: Ubuntu 18.04 / 18.10 / 19.04 / Debian 10
After downloading, execute the following command to install:
//下载依赖
root@zc:~# sudo apt --fix-broken install libcurl4 libqt5opengl5 libqt5printsupport5 libqt5x11extras5
//安装
root@zc:~# sudo dpkg -i virtualbox-6.0_6.0.6-130049~Ubuntu~bionic_amd64.deb
Download and install docker-machine
root@zc:~# curl -L https://github.com/docker/machine/releases/download/v0.13.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
root@zc:~# chmod +x /tmp/docker-machine &&
root@zc:~# sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
View version information
root@zc:~# docker-machine version
Reference address: https://blog.csdn.net/weixin_41464478/article/details/84634258