我的docker学习笔记4-守护式容器
$docker run -i -t ubuntu /bin/bash
$ctrl-p 或 ctrl-q # 转到后台
$docker ps
$docker attach cid
#exit
$docker run --name dc1 -d ubuntu / bin/bash
$docker ps
$docker logs -tf --tail 0 cid1
$docker top dc1
$docker exec -i -t -d cid1 cmd args
$docker stop cid # 发信号,等结束
$docker kill cid # 立刻停止
端口映射
docker run -p 80 --name web -i -t ubuntu /bin/bash
apt-get install -y nginx
apt-get install -y vim
mkdir -p /var/www/html
cd /var/www/html
vim index.html
whereis nginx
ls /etc/nginx
vim /etc/nginx/sites-enabled/default
cd/
nginx
ps -ef
ctrl-p
docker ps
docker port web
docker top web
curl http://127.0.0.1:49167
docker inspect
curl http://172.17.0.32
docker stop web
# 重启ip和端口会变
docker start -i web
docker exec web nginx
c-s运行模式:cli、app
三种socket连接方式,可配置
nc -U /var/run/docker.sock
GET /info HTTP/1.1