网站首页 > 技术教程 正文
Docker 是一个用于开发,交付和运行应用程序的开放平台。Docker 使您能够将应用程序与基础架构分开,从而可以快速交付软件。今天来为大家演示一下docker部署nginx |
环境
centos7
安装docker
移除旧版本docker
[root@chaols ~]# sudo yum remove docker \
> docker-client \
> docker-client-latest \
> docker-common \
> docker-latest \
> docker-latest-logrotate \
> docker-logrotate \
> docker-engine
安装yum-utils包并设置稳定存储库
[root@chaols ~]# yum install -y yum-utils
安装docker
[root@chaols ~]# yum install docker-ce docker-ce-cli containerd.io
启动docker
[root@chaols ~]# systemctl start docker
查看docker镜像
刚刚安装docker是没有镜像的
[root@chaols ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
部署nginx
下载nginx镜像
[root@chaols ~]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
e1acddbe380c: Pull complete
e21006f71c6f: Pull complete
f3341cc17e58: Pull complete
2a53fa598ee2: Pull complete
12455f71a9b5: Pull complete
b86f2ba62d17: Pull complete
Digest: sha256:4d4d96ac750af48c6a551d757c1cbfc071692309b491b70b2b8976e102dd3fef
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
创建nginx虚拟机
run 运行 -it 交互模式 --name 指定名字 -p 宿主机:docker虚拟机 nginx 镜像名字 /bin/bash 启动容器后启动bash
[root@chaols ~]# docker run -it --name chao.nginx -p 8080:80 nginx /bin/bash
root@8ebe4de10f2c:/# /etc/init.d/nginx start
2021/08/21 07:58:49 [notice] 11#11: using the "epoll" event method
2021/08/21 07:58:49 [notice] 11#11: nginx/1.21.1
2021/08/21 07:58:49 [notice] 11#11: built by gcc 8.3.0 (Debian 8.3.0-6)
2021/08/21 07:58:49 [notice] 11#11: OS: Linux 3.10.0-1160.el7.x86_64
2021/08/21 07:58:49 [notice] 11#11: getrlimit(RLIMIT_NOFILE): 1048576:1048576
root@8ebe4de10f2c:/# 2021/08/21 07:58:49 [notice] 12#12: start worker processes
2021/08/21 07:58:49 [notice] 12#12: start worker process 13
验证
猜你喜欢
- 2024-10-10 Linux下Docker部署Nginx并配置IPv6,实现公网访问
- 2024-10-10 nginx-linux服务器内核参数的优化
- 2024-09-12 如何在 LINUX 虚拟机上安装 NGINX Web 服务器
- 2024-09-12 【linux】Nginx 反向代理与负载均衡
- 2024-09-12 linux 安装nginx(linux安装nginx1.8)
- 2024-09-12 Linux下Nginx相关常用操作(linux+nginx)
- 2024-09-12 Linux搭建nginx,在window环境中访问
- 2024-09-12 nginx在linux下如何安装(linux怎么安装nginx)
- 2024-09-12 linux服务器下Nginx的搭建和部署(linux服务器nginx集群搭建)
- 2024-09-12 Linux运维笔记——Nginx详细安装部署
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)