First, the use of docker mirror / container
(1) create the container, and enter the command station
docker run --name 容器名 -i -t ubuntu /bin/bash
(2) Check / container
docker ps #查看正在running的容器
docker ps -a #查看所有的容器(running/stop)
docker ps -l #查看最后运行的容器
(3) Restart of the container and using
docker start 容器名
docker attache 容器名
(4) create a daemon
docker run --name damon_dave -d ubuntu /bin/bash
(5) create a daemon and enter
docker run -dit --name 容器名 ubuntu:latest /bin/bash
(6) the method into the container, exit () when you exit the container, which is still in the up state
docker exec -it 容器名 /bin/bash
(7) which enters the container, exit () when you exit the container, the container is no longer running background
docker attach 容器名
Two, Dockerfile use of docker
1, create a blueprint directory static_web, that is the parent directory dockerfile file
mkdir static_web
2. Create a file dockerfile
cd static_web && touch dockerfile
3, edit the file Dockfile
#Version:0.0.1
FROM ubuntu:latest
MAINTAINER Jack Turnbull "[email protected]"
RUN apt-get update && apt-get install -y nginx
RUN echo "<h1>Hi,I am in your container</h1>" > /user/share/nginx/html/index.html
EXPOSE 80
4, the mirror begins to build
docker build -t="/static_web" .
注意:需要带上. 表示static_web当前目录下的文件