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

相关推荐
物联网老王2 小时前
Ubuntu Linux Cursor 安装与使用一
linux·运维·ubuntu
FrankYoou4 小时前
Jenkins 与 GitLab CI/CD 的核心对比
java·docker
一位摩羯座DBA4 小时前
Redhat&Centos挂载镜像
linux·运维·centos
学习3人组4 小时前
CentOS配置网络
linux·网络·centos
隆里卡那唔4 小时前
在dify中通过http请求neo4j时为什么需要将localhost变为host.docker.internal
http·docker·neo4j
疯子的模样4 小时前
Docker 安装 Neo4j 保姆级教程
docker·容器·neo4j
weixin_307779134 小时前
Hive集群之间迁移的Linux Shell脚本
大数据·linux·hive·bash·迁移学习
漫步企鹅5 小时前
【蓝牙】Linux Qt4查看已经配对的蓝牙信息
linux·qt·蓝牙·配对
cui_win5 小时前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
梦在深巷、5 小时前
MySQL/MariaDB数据库主从复制之基于二进制日志的方式
linux·数据库·mysql·mariadb