Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install docker ce, docker-compose, docker-machine in Ubuntu

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to install docker ce, docker-compose and docker-machine in Ubuntu". In daily operation, I believe many people have doubts about how to install docker ce, docker-compose and docker-machine in Ubuntu. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to install docker ce, docker-compose and docker-machine in Ubuntu". Next, please follow the editor to study!

1. Ubuntu installation Docker-CE [1] Uninstall the old version

The old version of Docker is called docker or docker-engine, and use the following command to uninstall the old version:

Sudo apt-get remove docker docker-engine docker.io [2] install using APT

Because the apt source uses HTTPS to ensure that the software is not tampered with during download. Therefore, we first need to add the software package that uses the HTTPS transport and the CA certificate.

Sudo apt-get updatesudo apt-get install apt-transport-https ca-certificates curl software-properties-common

In view of domestic network problems, it is strongly recommended to use domestic sources. Please check the official sources in the notes.

In order to confirm the validity of the downloaded package, you need to add the GPG key of the software source.

Curl-fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add-# official source # $curl-fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add-

Then, we need to add the Docker software source to source.list

Sudo add-apt-repository\ "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu\ $(lsb_release-cs)\ stable" # official Source # sudo add-apt-repository\ # "deb [arch=amd64] https://download.docker.com/linux/ubuntu\ # $(lsb_release-cs)\ # stable"

The above command adds a stable version of the Docker CE APT mirror source. If you need to test or build a daily version of Docker CE, change the stable to test or nightly.

[3] install Docker CE

Update the apt package cache and install docker-ce:

Sudo apt-get updatesudo apt-get install docker-ce [4] successfully installed root@dk-machine:~# docker versionClient: Docker Engine-Community Version: 19.03.1 API version: 1.40 Go version: go1.12.5 Git commit: 74b1e89e8a Built: Thu Jul 25 21:21:35 2019 OS/Arch: linux/amd64 Experimental: falseServer: Docker Engine-Community Engine: Version: 19.03.1 API version: 1.40 minimum version 1.12) Go version: go1.12.5 Git commit: 74b1e89e8a Built: Thu Jul 25 21:20:09 2019 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.6 GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb runc: Version: 1.0.0-rc8 GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f docker-init: Version: 0.18.0 GitCommit: fec3683root@dk-machine:~#2 、 Configure image acceleration [1] for Ubuntu 16.04 +, Debian 8 +, CentOS 7

For systems that use systemd, write the following in / etc/docker/daemon.json (create a new file if it does not exist)

{"registry-mirrors": ["https://dockerhub.azk8s.cn"," https://reg-mirror.qiniu.com", "https://docker.mirrors.ustc.edu.cn",]}

Note that you must make sure that the file conforms to the json specification, otherwise Docker will not start.

Then restart the service.

Sudo systemctl daemon-reloadsudo systemctl restart docker

Docker official Chinese image acceleration: https://registry.docker-cn.com

NetEase: http://hub-mirror.c.163.com

University of Science and Technology of China: https://docker.mirrors.ustc.edu.cn

Ali Cloud Image acceleration: https://www.aliyun.com/product/acr?spm=5176.8142029.388261.563.e9396d3ejcUZkN (used after registration)

Daocloud: https://www.daocloud.io/mirror#accelerator-doc (used after registration, same as Ali image acceleration)

USTC: https://docker.mirrors.ustc.edu.cn

3. Install docker-compose and docker-machine

Docker-compose download address

Docker-machine download address

# plus executable permissions sudo chmod + x / usr/local/bin/docker-composesudo chmod + x / usr/local/bin/docker-machine

Just download the corresponding version. Here are the installation steps.

Root@dk-machine:/usr/local/bin# lsdocker-compose-Linux-x86_64 docker-machine-Linux-x86_64root@dk-machine:/usr/local/bin# mv docker-compose-Linux-x86_64 docker-composeroot@dk-machine:/usr/local/bin# lsdocker-compose docker-machine-Linux-x86_64root@dk-machine:/usr/local/bin# mv docker-machine-Linux-x86_64 docker-machineroot@dk-machine:/usr/local/bin# sudo chmod + x / usr/local/bin/docker-composeroot@dk-machine:/usr/local/bin# lsdocker-compose docker-machineroot@dk-machine:/usr/local/bin# sudo chmod + x / usr/local/bin/docker-machine root@dk-machine:/usr/local/bin# lsdocker-compose docker-machine

Installation succeeded, check the version

Root@dk-machine:/usr/local/bin# docker-compose versiondocker-compose version 1.24.1, build 4667896bdocker-py version: 3.7.3CPython version: 3.6.8OpenSSL version: OpenSSL 1.1.0j 20 Nov 2018root@dk-machine:/usr/local/bin# docker-machine-vdocker-machine version 0.16.1, build cce350d7 here, on "Ubuntu how to install docker ce, docker-compose, docker-machine" study is over, hope to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report