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

相关推荐
橘子真甜~44 分钟前
C/C++ Linux网络编程15 - 网络层IP协议
linux·网络·c++·网络协议·tcp/ip·计算机网络·网络层
拾贰_C2 小时前
【Linux | Windows | Terminal Command】 Linux---grep | Windows--- findstr
linux·运维·服务器
bloglin999992 小时前
启动容器报错ls: cannot access ‘/docker-entrypoint-initdb.d/‘: Operation not permitted
docker·容器·eureka
阿华hhh3 小时前
Linux系统编程(标准io)
linux·开发语言·c++
石像鬼₧魂石3 小时前
Kali Linux 网络端口深度扫描
linux·运维·网络
alengan3 小时前
linux上面写python3日志服务器
linux·运维·服务器
yBmZlQzJ4 小时前
免费内网穿透-端口转发配置介绍
运维·经验分享·docker·容器·1024程序员节
JH30734 小时前
docker 新手入门:10分钟搞定基础使用
运维·docker·容器
Rose sait4 小时前
【环境配置】Linux配置虚拟环境pytorch
linux·人工智能·python