在Ubuntu中Dcoker构建镜像
来源:互联网 发布:樱井知香喷泉图解 编辑:程序博客网 时间:2024/06/05 11:04
构建镜像
通过Dockerfile创建一个ubuntu带nginx的镜像
root@ubuntu:~# mkdir -p /dockerfile/df_test2root@ubuntu:~# cd /dockerfile/df_test2/root@ubuntu:/dockerfile/df_test2# vim Dockerfileroot@ubuntu:/dockerfile/df_test2# cat Dockerfile # 设置基本的镜像,后续命令都以这个镜像为基础 FROM ubuntu# 作者信息 MAINTAINER shangwu # RUN命令会在上面指定的镜像里执行任何命令 RUN apt-get updateRUN apt-get install -y nginx#暴露ssh端口EXPOSE 80 root@ubuntu:/dockerfile/df_test2# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEubuntu-nginx v1 8377a82bd88d 6 minutes ago 232.8 MBubuntu latest dc8dd8718e57 10 days ago 119.2 MB
执行Dockerfile
root@ubuntu:/dockerfile/df_test2# docker build -t='ubuntu-nginx-df_test2' .root@ubuntu:/dockerfile/df_test2# docker imagesREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEubuntu-nginx-df_test2 latest 266559c6bc7f 2 minutes ago 214.3 MBubuntu-nginx v1 8377a82bd88d 13 minutes ago 232.8 MBubuntu latest dc8dd8718e57 10 days ago 119.2 MBroot@ubuntu:/dockerfile/df_test2#
通过刚刚创建的进行启动一个容器=nginx-web3
root@ubuntu:/dockerfile/df_test2# docker run -d --name=nginx-web3 -p 80 ubuntu-nginx-df_test2 nginx -g "daemon off;"ffd39288dbdcd6af18beba89278e80e88d464e9e34388c4d61f181dfe3081d1croot@ubuntu:/dockerfile/df_test2# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESffd39288dbdc ubuntu-nginx-df_test2:latest "nginx -g 'daemon of 7 seconds ago Up 6 seconds 0.0.0.0:32771->80/tcp nginx-web3 892ba90fd7f0 ubuntu-nginx:v1 "nginx -g 'daemon of 12 minutes ago Up 12 minutes 0.0.0.0:32770->80/tcp nginx-web2 fbfacadb6dfe ubuntu-nginx:v1 "nginx -g 'daemon of 13 minutes ago Up 13 minutes 80/tcp nginx-web1 666dc69dc786 ubuntu:latest "/bin/bash" 8 hours ago Up About an hour 0.0.0.0:32769->80/tcp web root@ubuntu:/dockerfile/df_test2# curl http://127.0.0.1:32771<!DOCTYPE html><html><head><title>Welcome to nginx!</title><style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; }</style></head><body><h1>Welcome to nginx!</h1><p>If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.</p><p>For online documentation and support please refer to<a href="http://nginx.org/">nginx.org</a>.<br/>Commercial support is available at<a href="http://nginx.com/">nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p></body></html>root@ubuntu:/dockerfile/df_test2#
阅读全文
0 0
- 在Ubuntu中Dcoker构建镜像
- 脉冲云[编译构建]服务----使用Dockerfile文件,在线构建Dcoker镜像
- 3.3、Dcoker-1.12 Dockerfile,镜像制作详解以及使用说明
- 3.1、Dcoker-1.12 image(镜像)和container(容器)介绍以及查看[四]
- 3.2、Dcoker-1.12 search(搜索镜像)和pull(拉取镜像)[五]
- dcoker Registry 构建你自己的离线镜像库
- 在DOCKER中构建使用RUBY2.1及以上版本的镜像
- Cygwin中如何像在Ubuntu中一样安装软件
- Docker构建镜像
- 构建镜像
- Dockerfile 构建镜像
- docker_Dockerfile构建镜像
- 构建Tomcat镜像
- docker8 构建镜像
- 在虚拟机中使用iso镜像
- 在Thinstation中如何编译镜像
- Dockerfile构建本地镜像
- Docker 构建redis镜像
- 数据库DB分页查询
- Apache优化
- Apache简介
- Apache安装配置启用
- 【NOI2011】阿狸的打字机
- 在Ubuntu中Dcoker构建镜像
- 为什么要使用SLF4J而不是Log4J
- Apache配置详解
- sz与rz命令
- Java记录 -1- 基础JDK
- hdu 2510 符号三角形(dfs+打表)
- Java记录 -2- 原生数据类型
- Java记录 -3- 原生数据类型2
- Hadoop-HBASE 热添加新节点