aws ec2 安装docker,docker-compose
1、aws ec2 安装docker
1.1 、更新实例上已安装的程序包和程序包缓存
sudo yum update -y
1.2 、安装最新的 Docker Engine 程序包
sudo yum install -y amazon-linux-extras yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --enable extras
sudo amazon-linux-extras install docker
sudo service docker start
1.3、自启动
systemctl enable docker.service
1.4、设置容器日志的保存时长(可选)
cd /var/lib/docker/
journalctl --disk-usage
journalctl --vacuum-time=3month
2、 安装Docker Compose
2.1、下载Docker Compose
curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
2.2 、添加执行权限
chmod +x /usr/local/bin/docker-compose
如果提示找不到docker-compose命令执行如下语句
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
参考:https://blog.csdn.net/Tiger_lin1/article/details/127094524