Docker入坑系列(二)

Docker入坑系列(二)

上一篇我们为Docker创造了一个良好的生活环境,这一篇我们就开始让Docker活起来。

安装Docker

ok,原文地址在这里。

当然,我只是自己翻译了一下而已- -跟着做了一遍就安装好啦。

# Docker 是一个能够让应用自动化部署的基础软件框架。"容器"是封装好的,轻量级的便携式应用模块
# Docker is a container-based software framework for automating deployment of applications. “Containers” are encapsulated, lightweight, and portable application modules.
# 预检
# Pre-Flight Check
# 2014年6月 Docker官方正式发行v1.0.0版
# - As of June 2014 Docker has officially released v1.0.0.
# 这是如何安装Docker的使用说明
# - These instructions are intended for installing Docker.
# 我将在Liquid Web Core Managed Centos6.5服务器上安装Docker,并且是以root身份登陆的。
# - I’ll be working from a Liquid Web Core Managed CentOS 6.5 server, and I’ll be logged in as root.
# 添加EPEL资源库
# Add the EPEL Repository
# Docker 是EPEL扩展包的一部分,是RHEL发行的非标准的社区资源库。
# Docker is part of Extra Packages for Enterprise Linux (EPEL), which is a community repository of non-standard packages for the RHEL distribution. 

### 首先,我们先安装EPEL资源库
### First, we’ll install the EPEL repository:
rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

### 然后,我们最好更新一下我们的包
### Then, as a matter of best practice, we’ll update our packages:
yum update -y

### 介绍 现在让我们通过docker-io包安装docker
### Installation
### Now let’s install Docker by installing the docker-io package:
yum -y install docker-io

### 等安装完成后,我们需要后台启动Docker服务
### Once the installation completes, we’ll need to start the Docker daemon:
service docker start

### 最后,我们可以配置Docker服务开机自启。当然也可以不配置
### And finally, and optionally, let’s configure Docker to start when the server boots:
chkconfig docker on

### 下载一个Docker容器,让我们开始使用Docker,下载centos的Docker镜像
### Download a Docker Container
### Let’s begin using Docker! Download the centos Docker image:
docker pull centos

### 运行一个Docker容器
### Run a Docker Container
### 现在,构建一个带有bash shell命令的基本centos容器,我们只需要运行一个命令:docker run。就会创建一个新的容器。
### -i:附带着标准输入输出用来交互
### -t:将分配一个tty,我们将使用标准的fedora容器
### Now, to setup a basic centos container with a bash shell, we just run one command. docker run will run a command in a new container, -i attaches stdin and stdout, -t allocates a tty, and we’re using the standard fedora container.
docker run -i -t centos /bin/bash

### 现在你正在一个centos Docker容器中使用bash shell
### That’s it! You’re now using a bash shell inside of a centos docker container.
### 如想退出或者离开,请保持按下Ctrl键不动并依次按下pq键。
### To disconnect, or detach, from the shell without exiting use the escape sequence Ctrl-p + Ctrl-q.

### 这里有许多已经可以用的社区容器,他们可以通过search来找到,例如找一个centos
### There are many community containers already available, which can be found through a search. In the command below I am searching for the keyword centos:
docker search centos

累死了-。-蹩脚英文总算看懂了。所以,来图。

Docker安装完成图

Docker运行图

当然还有程序员的Helloworld。
Hello-World

原文地址:https://www.cnblogs.com/tdg-yyx/p/9486886.html