博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
docker hello-world
阅读量:7023 次
发布时间:2019-06-28

本文共 2387 字,大约阅读时间需要 7 分钟。

hot3.png

docker安装

Redhat & Contos: 系统要求, 64-bit Os and version 3.10

Ubuntu : 系统要求, 64-bit Os and version 3.10

从docker远程仓库拉去镜像到本地,name:拉去镜像的名称 , :tag:指定版本

docker pull [options] name[:tag]

查看本机有哪些镜像

docker images [options] [repository[:tag]]

docker for mac

    https://docs.docker.com/docker-for-mac/install/

 

获取镜像

xpMac:~ xupan$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
9bb5a5d4561a: Pull complete 
Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
Status: Downloaded newer image for hello-world:latest

 

查看镜像

xpMac:~ xupan$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              e38bc07ac18e        2 weeks ago         1.85kB

 

 

前台运行

docker run [options] image[:tag][command][arg...]
docker run hello-world

xpMac:~ xupan$ 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/engine/userguide/

 

 

 

网易蜂巢镜像中心 c.163.com/hub#/m/home

 

 

docker pull hub.c.163.com/library/nginx:latest

 

xpMac:~ xupan$ docker images

REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE

hello-world                   latest              e38bc07ac18e        2 weeks ago         1.85kB

hub.c.163.com/library/nginx   latest              46102226f2fd        12 months ago       109MB

 

xpMac:~ xupan$ docker run hub.c.163.com/library/nginx

 

xpMac:~ xupan$ docker ps

CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS              PORTS               NAMES

e0b5e0d49b8e        hub.c.163.com/library/nginx   "nginx -g 'daemon of…"   4 seconds ago       Up 4 seconds        80/tcp              modest_minsky

 

守护进程的方式运行

docker run -d ------------

docker run -d hub.c.163.com/library/nginx
5f8fd320577294f0f52226385c30c427c3d6512156e73c91bfa7eb364881e274
返回容器ID

 

 

进入容器

 docker exec it 5f8fd3205772 bash

root@5f8fd3205772:/# which nginx

/usr/sbin/nginx

 

转载于:https://my.oschina.net/u/2253438/blog/1805159

你可能感兴趣的文章
yii 验证码 CCaptcha的总结(转)
查看>>
oracle汉字占用字节长度
查看>>
python--条件判断和循环--3
查看>>
开发环境、生产环境、测试环境的基本理解和区别
查看>>
CSS布局:水平居中
查看>>
【HTTP】WireShark中获取Content-Encoding: gzip时的响应内容
查看>>
一些组织和个人网站
查看>>
二叉树应用进阶之折纸(二叉树的右根左遍历)
查看>>
运维相关开源项目
查看>>
Lua MD5加密字符串
查看>>
Heap & Priority Queue
查看>>
RDA PQ工具使用 (Adi Analysis)
查看>>
LEETCODE
查看>>
织云Lite发布:详解包管理核心能力
查看>>
hadoop04---shell
查看>>
HDU 4419 Colourful Rectangle(线段树)
查看>>
webservice接口的开发和调用
查看>>
【uTenux实验】内存池管理(固定内存池和可变内存池)
查看>>
Android——Android Studio的一些小技巧(转)
查看>>
Spring学习【Spring概述】
查看>>