centos7.9 docker测试安装最新版nginx
1、查看安装环境:
cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
docker --version
Docker version 20.10.11, build dea9396
2、安装并测试nginx启动
1、搜索镜像:
docker search nginx
注:最好去docker Hub上搜索:https://hub.docker.com/_/nginx
2、拉取镜像
docker pull nginx
3、查看下载完成的镜像
docker images nginx
REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest ea335eea17ab 13 days ago 141MB
4、启动镜像
docker run -d --name nginx01 -p 8044:80 nginx
06fed0dc071a2c48c9b7d6144aca93f7e52930af808170f92ee7d990ac3cae55
5、查看/测试启动成功
查看最近启动的容器
docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 06fed0dc071a nginx “/docker-entrypoint.…” 4 minutes ago Up 4 minutes 0.0.0.0:8044->80/tcp, :::8044->80/tcp nginx01
测试nginx启动成功
curl localhost:8044
输出:
|