Docker安装Ubuntu

2023-05-16

local

footstep@ubuntu:~$ ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:42ff:fe11:e9a4  prefixlen 64  scopeid 0x20<link>
        ether 02:42:42:11:e9:a4  txqueuelen 0  (Ethernet)
        RX packets 95092  bytes 8389850 (8.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 96253  bytes 164516574 (164.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.24.58  netmask 255.255.254.0  broadcast 192.168.25.255
        inet6 fe80::20c:29ff:fe98:3905  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:98:39:05  txqueuelen 1000  (Ethernet)
        RX packets 270096  bytes 229940235 (229.9 MB)
        RX errors 0  dropped 3  overruns 0  frame 0
        TX packets 155327  bytes 17546195 (17.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 255  bytes 19360 (19.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 255  bytes 19360 (19.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth5ae08ca: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::74fc:33ff:fe9b:6302  prefixlen 64  scopeid 0x20<link>
        ether 76:fc:33:9b:63:02  txqueuelen 0  (Ethernet)
        RX packets 28866  bytes 2560094 (2.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 29165  bytes 50721352 (50.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

footstep@ubuntu:~$

下载ubuntu镜像

docker pull ubuntu

 创建ubuntu容器

docker run -it -p 80:80 ubuntu /bin/bash

apt-get update

apt install wget net-tools

root@6ca17a06c281:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.2  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:ac:11:00:02  txqueuelen 0  (Ethernet)
        RX packets 29165  bytes 50721352 (50.7 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 28866  bytes 2560094 (2.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@6ca17a06c281:~# 

apt install gcc make libpcre3 libpcre3-dev zlib1g-dev

访问:

=>修改容器端口:

docker stop 6ca17a06c281(CONTAINER ID)

service docker stop

改变权限,进入 containers ,容器列表目录


sudo vim hostconfig.json (前为容器,后为宿主机端口)

sudo vim config.v2.json 

启动docker服务

启动容器并进入

编辑nginx配置端口88

 

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Docker安装Ubuntu 的相关文章

随机推荐