c创建python虚拟机_Docker-ce运用一:创建虚拟机
1、從遠程倉庫查看所需鏡像
[root@localhost docker]# docker search centos8
NAME???????????????????????????????? DESCRIPTION???????????????????????????????????? STARS?????????????? OFFICIAL??????????? AUTOMATED
thinakar/centos8???????????????????? centos8 core with net-utils, vim, sshuttle????? 0
memiiso/centos8-java8python3docker?? centos8-java8python3docker????????????????????? 0
memiiso/centos8-java8python3???????? centos8 With java8 and python3????????????????? 0
nmstate/centos8-nmstate-dev????????????????????????????????????????????????????????? 0
prestocpp/centos8-gcc9?????????????????????????????????????????????????????????????? 0
wuykimpang/centos8-extended????????????????????????????????????????????????????????? 0
memiiso/centos8-java8??????????????? centos8-java8?????????????????????????????????? 0
alekseychudov/centos8-systemd??????? CentOS 8 based systemd image??????????????????? 0
sharpreflections/centos8-build?????? CentOS8 with development tools????????????????? 0
ydli/centos8???????????????????????? centos8.2 with ansible-2.9.10, awscli-1.18.8…?? 0
vglad/centos8??????????????????????? Based on official latest CentOS 8 image with…?? 0
8378006361/centos8.2.2004??????????????????????????????????????????????????????????? 0
loging/centos8-python37????????????? centos8 + python3.7.5?????????????????????????? 0
krestomatio/centos8-minimal????????? Testing a Centos 8 minimal container image l…?? 0
2、從遠程倉庫拉取所需鏡像
[root@localhost docker]# docker pull alekseychudov/centos8-systemd
Using default tag: latest
latest: Pulling from alekseychudov/centos8-systemd
2b7820d659b3: Pull complete
Digest: sha256:a03592eb8be9af3c6c910d209b7d231a4aee19d42c72082ec6a3b021f323516b
Status: Downloaded newer image for alekseychudov/centos8-systemd:latest
docker.io/alekseychudov/centos8-systemd:latest
3、查看下載到本地鏡像
[root@localhost docker]# docker images
REPOSITORY????????????????????? TAG???????????????? IMAGE ID??????????? CREATED???????????? SIZE
mysql?????????????????????????? latest????????????? e3fcc9e1cc04??????? 12 days ago???????? 544MB
osism/kolla-ansible???????????? queens-latest?????? cfb5bad016bd??????? 5 months ago??????? 302MB
alekseychudov/centos8-systemd?? latest??????????? e13569384aea??????? 6 months ago??????? 256MB
4、創建容器
[root@localhost docker]# docker run -dit --name=centospy3 e13569384aea /bin/bash
7424ba3acdd87e4d65e8a3635914acf8152a745ec019e1f4cbd8873cd26f7f47
5、查看創建容器
[root@localhost docker]# docker ps -a
CONTAINER ID??????? IMAGE?????????????? COMMAND???????????? CREATED???????????? STATUS????????????? PORTS?????????????? NAMES
7424ba3acdd8??????? e13569384aea??????? "/bin/bash"???????? 2 minutes ago?????? Up 2 minutes??????????????????????????? centospy3
6、進入容器
[root@localhost docker]# docker exec -it centospy3 /bin/bash
[root@7424ba3acdd8 /]#
故障1:客戶機192.168.10.103與docker本地倉庫192.168.10.102網絡不通;
[root@localhost docker]# docker push 192.168.10.102:5000/client102-hello-world
The push refers to repository [192.168.10.102:5000/client102-hello-world]
Gethttps://192.168.10.102:5000/v2/: dial tcp 192.168.10.102:5000: connect: no route to host
解決辦法:查看網卡接口是否打開
[root@localhost docker]# nmcli connection
NAME???? UUID????????????????????????????????? TYPE????? DEVICE
ens33??? c96bc909-188e-ec64-3a96-6a90982b08ad? ethernet? ens33
ens34?? ?94aea789-efb3-ef4c-81b0-e8b18ecc9797? ethernet? ens34
docker0? 9fd5b1df-f8fc-4a54-a9b3-59119a6838ce? bridge??? docker0
[root@localhost docker]# nmcli c up ens33
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
故障2:docker本地倉庫的端口5000沒有開啟,通過本地防火墻開放端口
[root@localhost ~]# firewall-cmd --get-active-zones
查看防火墻活動區域
public
interfaces: ens33 ens34
[root@localhost ~]# firewall-cmd --zone=public --list-ports
查看防火墻的已開放端口
5000/tcp
[root@localhost ~]# firewall-cmd --zone=public? --add-port=5000/tcp --permanent
在public區域開放端口5000
success
[root@localhost ~]# firewall-cmd --zone=public --query-port=5000/tcp
查看端口5000是否開放
yes
[root@localhost ~]# firewall-cmd --reload
重啟軟件防火墻
Success
[root@localhost ~]# systemctl restart firewalld.service
重啟防火墻服務
故障3:報錯“ http: server gave HTTP response to HTTPS client”
解決辦法:
[root@localhost /]# vim /etc/docker/daemon.json
{
"insecure-registries": ["192.168.10.102:4000"]
設定非安全注冊為http
}
總結
以上是生活随笔為你收集整理的c创建python虚拟机_Docker-ce运用一:创建虚拟机的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 点石关键词排名优化软件_重庆关键词优化排
- 下一篇: python list 查找find_L