拉取nginx最新版本的镜像:

[mall@VM_0_7_centos ~]$ sudo docker pull nginx:latest
[sudo] password for mall:
latest: Pulling from library/nginx
8d691f585fa8: Pull complete
5b07f4e08ad0: Pull complete
abc291867bca: Pull complete
Digest: sha256:922c815aa4df050d4df476e92daed4231f466acc8ee90e0e774951b0fd7195a4
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest

  运行容器中的nginx,获取到配置文件:

[mall@VM_0_7_centos ~]$ sudo docker run -p : --name nginx \
> -v /mydata/nginx/html:/usr/share/nginx/html \
> -v /mydata/nginx/logs:/var/log/nginx \
> -d nginx:latest
fce640ef2b672b443a3db97455ffb6f7ba6cf2549a53178a41ea4e4b0dee9a2c

  复制容器中文件到本地:

[mall@VM_0_7_centos ~]$ sudo docker container cp ngix:/etc/nginx /mydata/nginx/

  修改/mydata/nginx/nginx为/mydata/nginx/conf

[mall@VM_0_7_centos ~]$ sudo mv /mydata/nginx/nginx /mydata/nginx/conf

  停止并删除容器:

[mall@VM_0_7_centos ~]$ sudo docker stop nginx
nginx
[mall@VM_0_7_centos ~]$ sudo docker rm nginx
nginx

  重新运行:

[mall@VM_0_7_centos ~]$ sudo docker run -p : --name nginx \
> -v /mydata/nginx/html:/usr/share/nginx/html \
> -v /mydata/nginx/logs:/var/log/nginx \
> -v /mydata/nginx/conf:/etc/nginx \
> -d nginx:latest
5683297894a25376143c44b6fee4e5d5eba4cafb1518df413e9447c94adf0b9a

docker安装并运行ngnix的更多相关文章

  1. Docker安装以及运行第一个HelloWorld

      Docker安装以及运行第一个HelloWorld

  2. Docker安装+HelloWorld+运行Tomcat

    前言 只有光头才能变强. 文本已收录至我的GitHub仓库,欢迎Star:https://github.com/ZhongFuCheng3y/3y 上一篇已经讲解了为什么需要Docker?,相信大家已 ...

  3. Docker安装并运行mysql5.6数据库

    1.在/home目录下新建mysql目录 mysql目录中新建三个目录:conf目录.logs目录.data目录,建这些目录的目的是用来挂载docker中的mysql下的目录的. 结果如下: 1.1. ...

  4. docker安装并运行redis

    拉取镜像: [mall@VM_0_7_centos ~]$ sudo docker pull redis:3.2 [sudo] password for mall: 3.2: Pulling from ...

  5. docker安装并运行kibana

    拉镜像: [mall@VM_0_7_centos ~]$ : Pulling from library/kibana 256b176beaff: Already exists 88643bded09c ...

  6. Docker 安装并运行 Redis

    说明 在Windows下运行Redis主要有以下几种方式: 使用微软官方构建的Windows版Redis,最新版本是3.0.504,发布于2016-07-01.https://github.com/m ...

  7. 使用docker安装和运行常用的数据库和中间件

    mysql: docker pull mysql: docker run --name mysql -p : -v /usr/share/zoneinfo/Asia/Shanghai:/etc/loc ...

  8. docker安装并运行mongo

    拉镜像: [mall@VM_0_7_centos ~]$ sudo docker pull mongo:3.2 [sudo] password for mall: 3.2: Pulling from ...

  9. docker安装并运行elasticsearch

    拉取镜像: [mall@VM_0_7_centos ~]$ [sudo] password for mall: : Pulling from library/elasticsearch 256b176 ...

随机推荐

  1. Pod生命周期和健康检查

    Pod生命周期和健康检查 Pod的生命周期涵盖了前面所说的PostStart 和 PreStop在内 Pod phase Pod的status定义在 PodStatus对象中,其中有一个phase字段 ...

  2. python的map和reduce函数

    map函数时python的高级内置函数 语法为:map(function, iterable, ...) 参数:function -- 函数iterable -- 一个或多个序列 将function作 ...

  3. 流Stream的关闭

    文章;MemoryStream.Close() or MemoryStream.Dispose() Close() and Dispose(), when called on a MemoryStre ...

  4. What is Code Quality?

    Ref detail : https://realpython.com/python-code-quality/ What is Code Quality? Of course you want qu ...

  5. Codeforces C. Split a Number(贪心大数运算)

    题目描述: time limit per test 2 seconds memory limit per test 512 megabytes input standard input output ...

  6. MyBatis框架之注解开发

    MyBatis注解开发 @Insert注解注解属性value:写入SQL语句 @Options注解实现添加新数据的主键封装注解属性useGeneratedKeys:使用生成的主键,配置为truekey ...

  7. computed配合watch监听对象数据

  8. python 添加Windows权限

    # -*- coding: utf-8 -*- """ Created on Mon Jan 8 09:09:51 2018 @author: coordinate &q ...

  9. Fiddler抓包工具使用指南|手机安装Fiddler的安全证书

    Fiddler 4 1.设置: Tools ->  Telerik Fiddler Options 勾选远程 手机安装证书 ->使用Android手机的浏览器打开:http://10.2. ...

  10. Kerberos身份验证流程

    介绍:Kerberos 是一种由 MIT(麻省理工大学)提出的一种网络身份验证协议.它旨在通过使用密钥加密技术为客户端/服务器应用程序提供强身份验证. 在 Kerberos 认证中,最主要的问题是如何 ...