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

相关推荐
源远流长jerry25 分钟前
Linux 网络虚拟化深度解析:从 veth 设备对到容器网络实战
linux·运维·服务器·网络·性能优化·php
|_⊙37 分钟前
Linux 深入理解文件(Ext2文件系统:上)
linux·运维·数据库
kidwjb39 分钟前
Linux共享内存
linux·服务器·进程间通信
红茶要加冰43 分钟前
七、正则表达式
linux·运维·正则表达式·shell
ALINX技术博客1 小时前
【黑金云课堂】FPGA技术教程Linux开发:串行通信接口与实时时钟模块
linux·fpga开发
sulikey1 小时前
ext2 GDT 块组描述符表 详细技术拆解
linux·操作系统·文件系统·ext2·gdt·ext·块组描述符
QuestLab1 小时前
Ollama在Linux上安装的详细记录
linux·运维·服务器
SPC的存折1 小时前
20、K8S-Pod驱逐
java·docker·kubernetes
Strugglingler1 小时前
【Linux PL011驱动支持RS485】
linux·uart·rs485·pl011
IT瑞先生1 小时前
Linux系统基础
linux·运维·服务器