Merge branch 'master' of github.com:yeasy/docker_practice

pull/155/head
Baohua Yang 2017-02-09 09:36:10 +08:00
commit af4ac70ceb
10 changed files with 38 additions and 11 deletions

View File

@ -56,3 +56,5 @@ LABEL name="CentOS Base Image" \
CMD ["/bin/bash"] CMD ["/bin/bash"]
``` ```

View File

@ -261,3 +261,4 @@ ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 27017 EXPOSE 27017
CMD ["mongod"] CMD ["mongod"]
``` ```

View File

@ -122,3 +122,5 @@ ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 3306 EXPOSE 3306
CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mysql"] CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mysql"]
``` ```

View File

@ -99,3 +99,5 @@ EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
``` ```

View File

@ -139,3 +139,5 @@ ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 6379 EXPOSE 6379
CMD [ "redis-server" ] CMD [ "redis-server" ]
``` ```

View File

@ -140,3 +140,5 @@ RUN sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
# overwrite this with 'CMD []' in a dependent Dockerfile # overwrite this with 'CMD []' in a dependent Dockerfile
CMD ["/bin/bash"] CMD ["/bin/bash"]
``` ```

View File

@ -115,3 +115,4 @@ COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"] CMD ["apache2-foreground"]
``` ```

View File

@ -56,6 +56,21 @@ $ docker inspect web
} }
... ...
``` ```
从Docker 1.8.0起,数据卷配置在"Mounts"Key下面可以看到所有的数据卷都是创建在主机的`/mnt/sda1/var/lib/docker/volumes/....`下面了。
```
"Mounts": [
{
"Name": "b53ebd40054dae599faf7c9666acfe205c3e922fc3e8bc3f2fd178ed788f1c29",
"Source": "/mnt/sda1/var/lib/docker/volumes/b53ebd40054dae599faf7c9666acfe205c3e922fc3e8bc3f2fd178ed788f1c29/_data",
"Destination": "/webapp",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
]
...
```
### 挂载一个本地主机文件作为数据卷 ### 挂载一个本地主机文件作为数据卷
`-v` 标记也可以从主机挂载单个文件到容器中 `-v` 标记也可以从主机挂载单个文件到容器中

View File

@ -45,5 +45,5 @@ CMD service nginx start
正确的做法是直接执行 `nginx` 可执行文件,并且要求以前台形式运行。比如: 正确的做法是直接执行 `nginx` 可执行文件,并且要求以前台形式运行。比如:
```Dockerfile ```Dockerfile
CMD ["nginx" "-g" "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
``` ```