服务器Docker容器化笔记
近期把服务器重新整了下,除了 NGINX 放在物理机上,别的全都容器化。服务器操作系统为Debian。以 Ghost 为例,过程如下:
前提
1 | # HTTPS support for APT |
安装 Docker 1
2
3
4
5
6
7
8
9
10# Add key and repo
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
cat << EOF > /etc/apt/sources.list.d/docker.list
deb https://apt.dockerproject.org/repo debian-jessie main
EOF
# Go!
apt-get update
apt-get install docker-engine
安装 NGINX
1 | # Add key and repo |
启动 Ghost 容器
1 | docker run -d --restart=always --name ghost -p 127.0.0.1:2368:2368 -e NODE_ENV=production -v /root/containers/ghost:/var/lib/ghost ghost |
注意,Ghost 的默认配置有个 Bug,至今为止还没修复,需要手动改一下
I figured it out. Be sure to add this in your config.js
to your production
property: 1
2
3paths: {
contentPath: path.join(process.env.GHOST_CONTENT, '/')
}
福利,启动 Shadowsocks 服务器
1 | docker run --name shadowsocks --restart=always -d -p 8388:8388 -p 8388:8388/udp -e PASSWORD=$YOUR_PASSWORD vimagick/shadowsocks-libev |