通常我們因?yàn)榘惭bdocker出現(xiàn)許多錯誤,使用解壓版安裝方便快捷,并且增加加速器的配置,以及可視化界面的配置,讓我們的成長更近了一步
1. 虛擬機(jī)網(wǎng)絡(luò)配置
虛擬機(jī)使用nat模式,配置ens33如下:
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR="192.168.30.30" # 設(shè)置的靜態(tài)IP地址
NETMASK="255.255.255.0" # 子網(wǎng)掩碼
GATEWAY="192.168.30.2" # 網(wǎng)關(guān)地址
DNS1="192.168.30.2" # DNS服務(wù)器
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
UUID=9396fbde-1f43-4a53-9f73-26ec0588eb77
NAME=ens33
DEVICE=ens33
ONBOOT=yes
ZONE=public
2. docker安裝
參考資料:
全網(wǎng)最新最全最詳細(xì) linux安裝docker方式 - 知乎
docker國內(nèi)鏡像庫地址 docker鏡像倉庫地址_mob6454cc74c0fc的技術(shù)博客_51CTO博客
國內(nèi)加速地址
Docker中國區(qū)官方鏡像 https://registry.docker-cn.com
網(wǎng)易??http://hub-mirror.c.163.com
ustc??https://docker.mirrors.ustc.edu.cn
中國科技大學(xué)??https://docker.mirrors.ustc.edu.cn
阿里云容器 服務(wù)??https://cr.console.aliyun.com/
#下載二進(jìn)制安裝包(因?yàn)槲铱梢赃B接互聯(lián)網(wǎng),不能連接互聯(lián)網(wǎng)的可以在自己電腦下載好在上傳)
[root@localhost ~]# wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz
#解壓壓縮包
[root@localhost ~]# tar -zxvf docker-20.10.9.tgz
[root@localhost ~]# ls
anaconda-ks.cfg ?docker ?docker-20.10.9.tgz
#將解壓docker目錄下的所有文件移動到/usr/bin下
[root@localhost ~]# mv docker/* /usr/bin
#以systemd的方式管理docker
cat > /usr/lib/systemd/system/docker.service << EOF
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
?
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
?
[Install]
WantedBy=multi-user.target
EOF
?
#配置鏡像加速器,Docker中國區(qū)官方鏡像 https://registry.docker-cn.com
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
??"registry-mirrors": ["https://registry.docker-cn.com"]
}
EOF
#啟動docker并設(shè)置開機(jī)自啟
systemctl daemon-reload
systemctl start docker
systemctl enable docker
#檢查docker是否安裝成功
[root@localhost ~]# docker run hello-world
?
Hello from Docker!
This message shows that your installation appears to be working correctly.
?
To generate this message, Docker took the following steps:
?1. The Docker client contacted the Docker daemon.
?2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
????(amd64)
?3. The Docker daemon created a new container from that image which runs the
????executable that produces the output you are currently reading.
?4. The Docker daemon streamed that output to the Docker client, which sent it
????to your terminal.
?
To try something more ambitious, you can run an Ubuntu container with:
?$ docker run -it ubuntu bash
?
Share images, automate workflows, and more with a free Docker ID:
?https://hub.docker.com/
?
For more examples and ideas, visit:
?https://docs.docker.com/get-started/
#直到出現(xiàn)以上才證明安裝成功?。?/span>
?
3. portainer 安裝
參考資料:
Docker 的可視化界面_docker可視化面板-CSDN博客
docker pull portainer/portainer
docker run -d ?-p 9000:9000 --name portainer --restart=always --privileged=true -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer文章來源:http://www.zghlxwxcb.cn/news/detail-812007.html
4. 驗(yàn)證
文章來源地址http://www.zghlxwxcb.cn/news/detail-812007.html
到了這里,關(guān)于Docker 安裝以及加速器配置的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!