docker上部署Nginx

1、下载最新版nginx

```$  docker pull ngnix 
[root@tome ~]# docker  pull nginx
Using default tag: latest
latest: Pulling from library/nginx
b4d181a07f80: Pull complete 
edb81c9bc1f5: Pull complete 
b21fed559b9f: Pull complete 
03e6a2452751: Pull complete 
b82f7f888feb: Pull complete 
5430e98eba64: Pull complete 
Digest: sha256:47ae43cdfc7064d28800bc42e79a429540c7c80168e8c8952778c0d5af1c09db
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest

2、查询是否安装成功

docker images

[root@tome ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
nginx        latest    4f380adfc10f   11 days ago    133MB

3、后台启动Nginx

docker run -d --name nginx01 -p 3344:80 nginx
[root@tome ~]# docker run -d --name nginx01 -p 3344:80 nginx
00c01a7fd3001435f104e89c017efa5a6bab5a46bfdaebef11d562600ef738fb

注释说明:
–name 给容器命令
-d 后台运行
-p 宿主机端口、容器内部端口

4、进入容器中

docker exec -it nginx02 /bin/bash
[root@tome ~]# docker exec -it nginx02 /bin/bash
root@6ae6bdd6a696:/# 
root@6ae6bdd6a696:/# whereis nginx
nginx: /usr/sbin/nginx /usr/lib/nginx /etc/nginx /usr/share/nginx
root@6ae6bdd6a696:/# cd /etc/nginx
root@6ae6bdd6a696:/etc/nginx# ls
conf.d	fastcgi_params	mime.types  modules  nginx.conf  scgi_params  uwsgi_params
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值