2

托管docker-getting-started(docker快速入门)页面 并使用 https 访问

 2 years ago
source link: https://hellodk.cn/post/411
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

centOS7 安装 docker

yum install docker

查看 docker 版本

docker -v
docker version

设置 docker autostart 并且 启动之

systemctl enable docker
systemctl start docker

可以先使用 systemctl is-enabled docker 查看 是 disabled 还是 enabled

拉取 docker-getting-started

docker pull docker/getting-started

查看 image id

docker images

比如 我这 docker/getting-started repo 的 image id 是 1f32459ef038

运行 docker image

docker run -dp 8080:80 docker/getting-started

-d 代表 run in the backgroud
-p 代表映射端口 冒号前面的 是 host port,冒号后面的是 container port,官方解释: map port 8080 of the host to port 80 in the container

上述 run 命令后面的 image 也可以使用 image id 下面是示例

docker run -dp 8080:80 1f32459ef038

正常启动后 我们现在已经可以使用 http://hellodk.com:8080 来访问这个文档了

使用 宿主机的nginx配置一层转发 并且部署服务器上的ssl证书 使用https访问该页面

配置一个 docker-getting-started.conf
配置此处略去

可以使用 docker-getting-started.hellodk.com 访问,可以重定向到https下,最终访问页面 https://docker-getting-started.hellodk.com


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK