当前位置 博文首页 > 我的地盘我做主:【Linux】【开发环境】【RHEL】开发环境搭建系
对于开发人员:Build Once,Run Anyware.
对于运维人员:Configure Once,Run Anyware.
[qxhgd@localhost ~]$ sudo yum install docker
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-
: manager
...
Complete!
[qxhgd@localhost ~]$ docker
Usage: docker COMMAND
A self-sufficient runtime for containers
Options:
...
Commands:
...
Run 'docker COMMAND --help' for more information on a command.
[qxhgd@localhost ~]$ docker version
Client:
Version: 1.13.1
API version: 1.26
Package version:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[qxhgd@localhost ~]$ sudo docker search tutorial
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/learn/tutorial
[qxhgd@localhost ~]$ sudo docker pull learn/tutorial
Using default tag: latest
Trying to pull repository docker.io/learn/tutorial ...
latest: Pulling from docker.io/learn/tutorial
271134aeb542: Downloading [=============================================> ] 64.83 MB/71.04 MB
[qxhgd@localhost ~]$ sudo docker run learn/tutorial echo "hello word"
[sudo] password for qxhgd:
hello word
[qxhgd@localhost ~]$ sudo docker run learn/tutorial apt-get install -y ping
$ [qxhgd@localhost ~]$ sudo docker run learn/tutorial sleep 100000
[qxhgd@localhost ~]$ sudo docker ps
[sudo] password for qxhgd:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7e8d3a0e2aae learn/tutorial "sleep 100000" 16 seconds ago Up 14 seconds affectionate_dijkstra
[qxhgd@localhost ~]$ sudo docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7e8d3a0e2aae learn/tutorial "sleep 100000" 18 seconds ago Up 17 seconds affectionate_dijkstra
$ docker commit 7e8 learn/sleep
$ docker push learn/sleep
# docker安装
- yum install docker #安装docker
# docker基本操作
- docker #查看docker命令格式
- docker -v #查看docker版本
- docker version #查看docker版本
# docker镜像搜索与安装
- docker search tutorial #搜索tutorial镜像
- docker pull learn/tutorial #安装tutorial镜像
# docker容器操作
- docker ps #查看所有正在运行中的容器列表
- docker ps -l #查看所有正在运行中的容器列表
- docker inspect #查看更详细的关于某一个容器的信息
- docker commit 7e8 learn/sleep #保存容器快照
- docker images #查看本地所有镜像
- docker push learn/sleep #发布快照
- docker run learn/tutorial echo "hello word" #镜像中执行echo命令
- docker run learn/tutorial apt-get install -y ping #镜像中安装ping命令
- docker run learn/tutorial sleep 100000 #执行sleep操作
- docker start #启动一个或多个已经被停止的容器
- docker stop #停止一个运行中的容器
- docker restart #重启容器
如本文对你有些许帮助,欢迎打赏:
支付宝打赏链接