安装docker

2022-05-06  本文已影响0人  飞鹰雪玉

在线安装docker

curl -sSL https://get.daocloud.io/docker | sh
systemctl start docker
docker info

修改镜像存储目录

systemctl stop docker
mkdir -p /data/docker/lib/
rsync -avz /var/lib/docker /data/docker/lib/
vim /usr/lib/systemd/system/docker.service

添加配置:

ExectStart=xxx --graph /data/docker/lib/docker

修改镜像源

vim /etc/docker/daemon.json

添加配置:

{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}
systemctl disable docker
systemctl enable docker
systemctl daemon-reload
systemctl start docker

离线安装docker-compose

wget https://github.com/docker/compose/releases/download/v2.0.1/docker-compose-linux-x86_64
mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version

在线安装docker-compose

curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
或者
curl -L "https://get.daocloud.io/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version

查看docker容器

docker ps -a

查看docker进程

docker top CONTAINER [ps OPTIONS]
#例如
docker top redis
上一篇下一篇

猜你喜欢

热点阅读