安装以Centos系统,包含docker、docker-compose
Docker安装
# 安装一些必要工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# 添加软件源信息
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 更新 yum 缓存
sudo yum makecache fast
# 安装 Docker-ce
sudo yum -y install docker-ce
# 启动 Docker 后台服务
sudo systemctl start docker
# 测试docker运行
docker run hello-world
安装Docker-Compose
- 下载docker-compose安装包
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- 授予执行权限
sudo chmod +x /usr/local/bin/docker-compose
- 查看安装版本
docker-compose --version
Docker开启远程访问
- enable docker
systemctl enable docker
- vi /usr/lib/systemd/system/docker.service 修改 [Service]的ExecStart,ExecStart= 一定要加
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
- 刷新配置文件,重启docker
systemctl daemon-reload
systemctl restart docker
- 查看是否配置成功
[root@localhost ~]# netstat -ano | grep 2375
tcp6 0 0 :::2375 :::* LISTEN off (0.00/0/0)
- 连接地址:tcp://127.0.0.1:2375
NodeJS安装
curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash
sudo yum -y install nodejs
npm -v