Docker 

在CentOS 7.0下安装Docker, CentOS 7.0默认使用的是firewall作为防火墙

  • 查看防火墙状态
    firewall-cmd --state
  • 停止firewall
    systemctl stop firewalld.service
  • 启动firewall
    systemctl start firewalld.service
  • 禁止firewall开机启动
    systemctl disable firewalld.service

1.移除旧版本:

yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine

2.安装必要依赖:

yum install -y yum-utils device-mapper-persistent-data lvm2

3.更换国内镜像:

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

4.更新 yum 缓存:

yum makecache fast

5.安装 Docker-ce:

yum -y install docker-ce

6.启动 Docker 后台服务

systemctl start docker

7.测试运行 hello-world

docker run hello-world

8.运行交互式容器

root@root:~$ docker run -it ubuntu:15.10 /bin/bash
root@dc0050c79503:/#
  • -i:允许你对容器内的标准输入进行交互
  • -t:在新容器内指定一个伪终端或终端
  • -d: 后台启动容器
  • –rm:容器退出后立即删除容器。一般情况下,无需指定此参数,指定--rm可以避免浪费空间

退出容器交互命令 ctrl+d

9.后台运行容器

root@root:~$ docker run -d ubuntu:15.10 /bin/bash
root@dc0050c79503:/#

10.查看运行的容器

[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
46353af5c8ce ubuntu:15.10 "/bin/bash" 4 minutes ago Up 4 minutes gracious_allen

11.停止容器

[root@localhost ~]# docker stop 46353af5c8ce
46353af5c8ce

12.查看本机镜像

[root@localhost ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
zookeeper latest f336949ce7a1 6 weeks ago 148MB
hello-world latest 4ab4c602aa5e 3 months ago 1.84kB
ubuntu 15.10 9b9cb95443b5 2 years ago 137MB
training/webapp latest 6fae60ef3446 3 years ago 349MB

结构说明:

  • REPOSITORY:仓库名称
  • TAG:标签名称
  • IMAGE ID:镜像ID
  • CREATED:创建时间
  • SIZE:所占用的空间

列出指定镜像

[root@localhost ~]# docker image ls ubuntu
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 15.10 9b9cb95443b5 2 years ago 137MB

13.删除镜像

[root@localhost ~]# docker image rm 6fae60ef3446

14.查找镜像

[root@localhost ~]# docker search ubuntu
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
ubuntu Ubuntu is a Debian-based Linux operating sys… 8910 [OK]
dorowu/ubuntu-desktop-lxde-vnc Ubuntu with openssh-server and NoVNC 253 [OK]
rastasheep/ubuntu-sshd Dockerized SSH service, built on top of offi… 187 [OK]

Docker入门-安装(一)的更多相关文章

  1. Docker入门 安装Tomcat以及报404解决方案

    时间:2020/1/18 17:34:09 浏览:24 来源:互联网 记录简单的在Docker 上安装Tomcat 首先我是在云服务器上(Centos系统)安装的Docker,我们需要在https:/ ...

  2. docker入门——安装(CentOS)、镜像、容器

    Docker简介 什么是docker 官方解释: Docker is the company driving the container movement and the only container ...

  3. Docker探索系列1之docker入门安装与操作

    preface docker这种时髦的技术我接触的比较晚,如果不是公司在使用这项技术,估计还得会更晚接触.好了,说下我司现在docker使用的情况.docker在我司是用来跑web服务的,里面的web ...

  4. docker入门——安装及简单操作

    和安装其他软件一样,安装Docker也需要一些基本的前提条件.Docker要求的条件具体如下: 运行64位CPU构架的计算机(目前只能是x86_64和amd64),Docker目前不支持32位CPU. ...

  5. docker入门-安装篇

    一.docker介绍 1:docker官网 www.docker.com 2:github  https://github.com/docker/docker.github.io 3:开源的容器引擎, ...

  6. Docker入门 安装 基础操作命令

    Docker 学习来源 https://www.bilibili.com/video/av26993050/?spm_id_from=333.788.b_636f6d6d656e74.20 https ...

  7. Docker入门1------概念和安装

    关于docker的介绍: https://www.cnblogs.com/neptunemoon/p/6512121.html docker入门教程:http://www.docker.org.cn/ ...

  8. SpringBoot Docker入门,SpringBoot Docker安装

    SpringBoot Docker入门,SpringBoot Docker安装 ================================ ©Copyright 蕃薯耀 2018年4月8日 ht ...

  9. 【实战】Docker 入门实战一:ubuntu 和 centos 安装Docker

    Docker是什么 Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从Apache2.0协议开源.Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级.可移植的容器中,然后发布 ...

随机推荐

  1. go笔记-限速器(limiter)

    参考: https://blog.csdn.net/wdy_yx/article/details/73849713https://www.jianshu.com/p/1ecb513f7632 http ...

  2. 如何将多个C文件链接在一起----Makefile编写及make指令

    需使用GCC编译器,关于MinGW的安装指南:https://people.eng.unimelb.edu.au/ammoffat/teaching/20005/Install-MinGW.pdf 单 ...

  3. java对象池commons-pool-1.6详解(一)

    自己的项目中用到了 对象池 commons-pool: package com.sankuai.qcs.regulation.protocol.client; import com.dianping. ...

  4. Codechef April Challenge 2019 Division 2

    Maximum Remaining 题意:给n个数,取出两个数$a_{i}$,$a_{j}$,求$a_{i}\% a_{j}$取模的最大值 直接排个序,第二大(严格的第二大)模第一大就是答案了. #i ...

  5. 使用with语句优化pymysql的操作

    一.with语句的好处 with语句的好处在于,它可以自动帮我们释放上下文,就比如文件句柄的操作,如果你不使用with语句操作,你要先open一个文件句柄,使用完毕后要close这个文件句柄,而使用w ...

  6. 初识服务器和Linux

    一.什么是计算机 1.介绍 一说到计算机,我们首先想到的就是电脑,没错,电脑就是计算机,但是计算机不只是电脑. 所谓的电脑就是一种计算机,而计算机其实是:接收使用者输入的指令与资料,经中央处理器的数学 ...

  7. FileZilla-02

    WordPress的权限方案 通常,所有文件应由您的Web服务器上的用户(ftp)帐户拥有,并且应该可由该帐户写入.在共享主机上,文件永远不应归Web服务器进程本身所有(有时这是www,或apache ...

  8. windows 8.1 cmd命名提示符全屏

    在 C:\Users\wy\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools 目录下,右键命令提示符-属性中修改:

  9. HTML div 盒子 添加/删除——浮层

    1.clear语法:clear : none | left|right| both 2.clear参数值说明:none : 允许两边都可以有浮动对象both : 不允许有浮动对象left : 不允许左 ...

  10. Thinkphp5.1 ORM UML

    Thinkphp5.1 ORM  UML think-orm