docker的使用
docker安装docker的基本安装卸载旧版本安装 Docker Engine-Community安装yum的基本软件设置阿里云仓库源地址安装docker引擎安装特定版本的dockerdocker的基本操作启动docker并查看版本号验证安装docker正确容器相关命令容器查看列表正在运行容器查看列表所有(包括未运行信息)容器查看详情容器删除容器启动实际应用openGauss的安装docker的
·
docker安装
docker的基本安装
卸载旧版本
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
安装 Docker Engine-Community
安装yum的基本软件
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
设置阿里云仓库源地址
$ sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装docker引擎
安装最新版本的 Docker Engine-Community 和 containerd,或者转到下一步安装特定版本:
$ sudo yum install docker-ce docker-ce-cli containerd.io
安装特定版本的docker
$ yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
这个是指定特定版本的docker的安装
sudo yum install docker-ce-19.03.9 docker-ce-cli-19.03.9 containerd.io
docker的基本操作
启动docker并查看版本号
$ sudo systemctl start docker
docker version
验证安装docker正确
[root@localhost ~]# docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
容器相关命令
容器查看列表正在运行
docker ps
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7765f5165e4b enmotech/opengauss:latest "entrypoint.sh gauss…" 26 minutes ago Up 26 minutes 0.0.0.0:5432->5432/tcp opengauss
容器查看列表所有(包括未运行信息)
docker ps -a
容器查看详情
docker inspect xxxedc27c2341bxxx
容器删除
docker rm xxx容器IDxxx
容器启动
- 容器的创建及启动
docker run --name opengauss --privileged=true -d -e GS_PASSWORD=secretpassword@123 -p 5432:5432 enmotech/opengauss:latest
其中
-p 5432:5432 理解为 前面是对应的宿主机端口号,后面对应的是容器的版本号
- 单纯的容器的启动
docker restart 7765f5165e4b(容器ID)
- 持久化存储数据的启动
docker run --name opengauss --privileged=true -d -e GS_PASSWORD=secretpassword@123 -p 5432:5432 \
-v /enmotech/opengauss:/var/lib/opengauss \
enmotech/opengauss:latest
实际应用
openGauss的安装
首先要安装好docker软件
- pull docker文件
docker pull enmotech/opengauss
- 启动openGuass实例
$ docker run --name opengauss --privileged=true -d -e GS_PASSWORD=secretpassword@123 -p 5432:5432 enmotech/opengauss:latest
openGauss的用户创建与授权
https://www.modb.pro/db/27572
更多推荐
已为社区贡献2条内容
所有评论(0)