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

相关推荐
MilesShi2 小时前
从 scheduler_tick 到上下文切换:深入解析 Linux 内核的 TIF_NEED_RESCHED 标志设置流程
linux·运维·单片机
我爱云计算5 小时前
K8S详解(5万字详细教程)
linux·运维·云原生·容器·kubernetes
帝国辉耀15 小时前
docker、docker daemon、k8s、dockershim、containerd之间的关系
docker·容器·kubernetes
明明跟你说过5 小时前
【k8s】资源限制管理:Namespace、Deployment与Pod的实践
运维·docker·云原生·容器·kubernetes·k8s
2301_794333917 小时前
实验室服务器配置|通过Docker实现Linux系统多用户隔离与安全防控
linux·服务器·docker·实验室
Molesidy8 小时前
【UAV】基于PX4+Ubuntu24.04.3的无人机制作的开发环境搭建
ubuntu·无人机·px4·gazebo·uav
JCGKS8 小时前
Docker|“ssh: connect to host xxx.xxx.xxx.xxx port 8000: Connection refused“问题解决
docker·ssh·端口·listen·tcp三次握手
荣光波比8 小时前
Nginx 实战系列(一)—— Web 核心概念、HTTP/HTTPS协议 与 Nginx 安装
linux·运维·服务器·nginx·云计算
惜.己9 小时前
Docker启动失败 Failed to start Docker Application Container Engine.
spring cloud·docker·eureka
scugxl9 小时前
centos7 docker离线安装
运维·docker·容器