docker pull openresty/openresty docker images
docker run -it -m 100MB -h doc.nginx -d --name="nginx" openresty/openresty
示例: docker run -itd --name="cent" -m 512M -p 8080:80 -p 9000:9000 -v /Users/moran/Documents/angular/:/data/angular centos
# 常用操作 docker inspect 容器名字 # 查看容器的信息 docker attach docker creeate docker run docker top docker cp docker logs docker exec -it 容器名字 bash
docker ps -[l|a] docker start|stop|restart|pause|unpause 容器名字/ID docker rm 容器 docker rmi 镜像
docker build docker history
示例: 在官方centos7镜像上 安装一个node环境(虽然node也有镜像 但更喜欢自己装) docker pull centos docker run -itd --name="cent" -m 512M -p 8080:80 -p 9000:9000 -v /Users/moran/Documents/angular/:/data/angular centos docker attach cent
yum install wget vim gcc-c++ make -y yum install gem -y gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/ gem install compass
cd /tmp wget https://nodejs.org/dist/v6.9.1/node-v6.9.1.tar.gz tar zxvf node-v6.9.1.tar.gz cd node-v6.9.1 ./configure make make install
npm install -g cnpm --registry=https://registry.npm.taobao.org cnpm install -g grunt-cli cnpm install -g yo cnpm install -g bower cnpm install -g generator-karma cnpm install -g generator-angular
docker commit 版本ID 远程仓库
|