Docker基础——指令整理

1、Docker 拷贝容器文件到宿主机/mnt

[root@harbor ~]# docker cp nginx:/etc/nginx/nginx.conf /mnt
[root@harbor ~]# ls /mnt
nginx.conf

2、Docker 关闭所有容器

[root@harbor ~]# docker-compose -f /apps/conf/harbor/harbor/docker-compose.yml down
Removing nginx             ... done
Removing harbor-jobservice ... done
Removing harbor-core       ... done
Removing harbor-portal     ... done
Removing registryctl       ... done
Removing redis             ... done
Removing registry          ... done
Removing harbor-db         ... done
Removing harbor-log        ... done
Removing network harbor_harbor
WARNING: Network harbor_harbor not found.

3、Docker 开启所有容器

[root@harbor ~]# docker-compose -f /apps/conf/harbor/harbor/docker-compose.yml up -d
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating redis         ... done
Creating harbor-portal ... done
Creating registryctl   ... done
Creating harbor-db     ... done
Creating registry      ... done
Creating harbor-core   ... done
Creating harbor-jobservice ... done
Creating nginx             ... done

 4、Docker查看容器文件

[root@harbor harbor]# docker exec -it mysql-master bash -c "cat /etc/hosts"
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.27.0.2      cf8d31a9d21e

 

posted on 2025-06-30 16:42  gkhost  阅读(10)  评论(0)    收藏  举报

导航