docker

docker命令

docker images: 查看镜像

docker ps: 查看容器

创建Dockerfile

1
2
3
4
5
6
7
FROM nginx
MAINTAINER username "username@example.com"
ADD build /usr/share/nginx/html
ADD nginx_server.conf /etc/nginx/conf.d/default.conf
ADD gzip.conf /etc/nginx/conf.d/gzip.conf
EXPOSE 80:80
ENTRYPOINT /bin/bash -c "nginx -g 'daemon off;'"

docker image COMMAND 查看命令

1
2
3
4
5
6
7
8
9
10
11
12
build       Build an image from a Dockerfile
history Show the history of an image
import Import the contents from a tarball to create a filesystem image
inspect Display detailed information on one or more images
load Load an image from a tar archive or STDIN
ls List images
prune Remove unused images
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rm Remove one or more images
save Save one or more images to a tar archive (streamed to STDOUT by default)
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
tar cf build.tag.gz build:压缩文件
tar xf build.tar.gz: 解压文件
scp -r build.tar.gz root@ip:/root/: 上传文件到服务器
docker build -t blog .: 构建镜像,镜像名为blog
docker run -d -p 8080:80 blog:基于镜像blog生成容器,8080为公网端口
Author

wangzq

Posted on

2020-09-18

Updated on

2020-09-18

Licensed under

Comments

You need to set client_id and slot_id to show this AD unit. Please set it in _config.yml.