ubuntu系统Docker常用命令

1.查看docker是否开机启动

sudo systemctl list-unit-files | grep enable|grep docker

2.设置开机启动

sudo systemctl enable docker

3.关闭docker开机启动

sudo systemctl disable docker

4.开启docker服务

sudo service docker start

5.关闭docker服务

sudo service docker stop

6.查看已下载到本地仓库的镜像

docker images

7.查询镜像

docker search 镜像名,如docker search hello-world

8.从远程仓库拉取镜像

docker pull 镜像名,如docker pull hello-world

9.查看docker中启动的容器

docker ps

10.查看docker中所有的容器

docker ps -a

11.将镜像放入容器,并启动容器

docker run 镜像名,如docker run hello-world (该命令一般在第一次启动容器时使用)

12.启动已停止的容器

docker start 容器名,如docker start hello-world

13.进入一个已启动的容器

docker exec -it 容器名 命令模式,如docker exec -it jdk1.8 bash

14.添加docker软件源

sudo add-apt-repository "deb arch=amd64 http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

  1. 将用户添加到 Docker 用户组 (your_username替换为你的用户名)

sudo usermod -aG docker your_username

16.查看Docker用户组信息

getent group docker

17.更新用户组

newgrp docker

相关推荐
心心喵几秒前
[linux] nohup和pm2的区别 进程保活
linux·运维·服务器
醉熏的石头1 小时前
Ubuntu 中的编程语言(中)
linux·ubuntu·scala
AI服务老曹2 小时前
视觉算法模型管理完整流程:多版本上线、灰度发布与回滚的落地实践
人工智能·docker·音视频
辉的技术笔记4 小时前
拆解 Dify 的 Celery:15 个队列都在干什么
docker
dddwjzx4 小时前
嵌入式Linux C应用编程入门——信号
linux·嵌入式
范什么特西5 小时前
网络代理问题
java·linux·服务器
utf8mb4安全女神5 小时前
【Redis数据库】哨兵集群/redis集群/安装配置/主从复制/数据持久化操作/数据结构/安全限制/PHP redis/
linux·服务器·数据结构·数据库·redis·缓存
Zk.Sun6 小时前
Linux设置触屏双击距离容差
linux·运维·数据库
bukeyiwanshui6 小时前
20260622 安装配置ubuntu
linux·运维·ubuntu
写代码的学渣6 小时前
Linux 安装 Swap 交换分区大小标准(通用 + 生产服务器 + 个人 PC)
linux·运维·服务器