环境
Docker环境安装
sudo apt-get update
sudo apt-get upgrade
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
- 安装Docker Engine Community
sudo apt-get install docker-ce docker-ce-cli containerd.io
初体验
docker run -p 6379:6379 --name redis \
-v /opt/data/redis/conf/redis.conf:/etc/redis/redis.conf \
-v /opt/data/redis/data:/data \
-d redis redis-server /etc/redis/redis.conf \
--appendonly yes
docker run -p 3306:3306 --name mysql \
-v /opt/data/mysql/conf:/etc/mysql/conf.d \
-v /opt/data/mysql/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=[your-passwd]\
-d mysql:[mysql-version-tag]
docker run -p 27017:27017 --name mongodb \
-v /opt/data/mongodb/data:/data/db \
-v /opt/data/mongodb/conf:/etc/mongo \
-e MONGO_INITDB_ROOT_USERNAME=[username]\
-e MONGO_INITDB_ROOT_PASSWORD=[passwd] \
-d mongo:[mongodb-version-tag]
Liunx时区设置
date -R
tzselect
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Linux时间同步
apt-get install ntpdate
ntpdate time.nist.gov
*/360 * * * * ntpdate time.nist.gov
time.nist.gov
time.nuri.net
0.asia.pool.ntp.org
1.asia.pool.ntp.org
2.asia.pool.ntp.org
3.asia.pool.ntp.org
参考资料
Docker Documents