1安装docker的apt源

apt-get install apt-transport-https ca-certificates curl software-properties-common

2添加docker官方的GPG

root@zhf-linux:/home#

curl -s https://download.docker.com/linux/ubuntu/gpg | sudo apt-key

add -

OK

3添加docker的源。如果没有docker.list则自己创建一个

root@zhf-linux:/etc/apt/sources.list.d#

bash -c "echo deb https://get.docker.io/ubuntu docker main >

/etc/apt/sources.list.d/docker.list"

4安装docker

apt

install docker.io

5查看docker的版本:

root@zhf-linux:/var/lib/docker#

docker version

Client:

Version:

1.13.1

API

version: 1.26

Go

version: go1.6.2

Git

commit: 092cba3

Built:

Thu Sep 7 17:23:05 2017

OS/Arch:

linux/386

Server:

Version:

1.13.1

API

version: 1.26 (minimum version 1.12)

Go

version: go1.6.2

Git

commit: 092cba3

Built:

Thu Sep 7 17:23:05 2017

OS/Arch:

linux/386

Experimental:

false

到这里docker整个就安装完了,我们来看下如何来启动一个镜像

1通过docker

run命令来启动一个httpd的镜像。如果没有发现httpd镜像会从docker

hub下载镜像。下载完成后,镜像httpd被保存到本地

docker

run -d -p 80:80 httpd

2

docker images可以看到已经下载到本地

root@zhf-linux:/home/zhf/zhf/c_prj/make_function#

docker images

REPOSITORY

TAG IMAGE ID CREATED

SIZE

httpd

latest 7659d5a9a057 2 weeks ago

189 MB

3

docker ps显示容器正在运行

root@zhf-linux:/home/zhf/zhf/c_prj/make_function#

docker ps

CONTAINER

ID IMAGE COMMAND CREATED

STATUS PORTS NAMES

39ae70ca12b2

httpd "httpd-foreground" 6 minutes

ago Up 6 minutes 0.0.0.0:80->80/tcp

compassionate_bohr

接下来看下如何下载一个镜像。通过docker

pull下载。docker

pull会从Docker

Hub进行下载。

root@zhf-linux:/home/zhf/zhf/c_prj/make_function#

docker pull hello-world

Using

default tag: latest

latest:

Pulling from library/hello-world

cf7dde121f94:

Pull complete

Digest:

sha256:0e06ef5e1945a718b02a8c319e15bae44f47039005530bc617a5d071190ed3fc

Status:

Downloaded newer image for hello-world:latest

通过docker

images看到这个镜像只有600多K

root@zhf-linux:/home/zhf/zhf/c_prj/make_function#

docker images hello-world

REPOSITORY

TAG IMAGE ID CREATED

SIZE

hello-world

latest abd130ec0722 3 months ago

665 kB

通过docker

run hello-world来执行。结果如下:

root@zhf-linux:/home/zhf/zhf/c_prj/make_function#

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.

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://cloud.docker.com/

For

more examples and ideas, visit:

下载的docker镜像默认存储路径是/var/lib/docker

.具体的镜像文件就在containers文件夹中

root@zhf-linux:/var/lib/docker#

ls -al

total

44

drwx--x--x

11 root root 4096 Oct 30 22:28 .

drwxr-xr-x

79 root root 4096 Dec 11 21:08 ..

drwx------

5 root root 4096 Oct 30 22:28 aufs

drwx------

8 root root 4096 Dec 19 20:59 containers

drwx------

3 root root 4096 Oct 30 22:28 image

drwxr-x---

3 root root 4096 Oct 30 22:28 network

drwx------

4 root root 4096 Oct 30 22:28 plugins

drwx------

2 root root 4096 Oct 30 22:28 swarm

drwx------

2 root root 4096 Dec 19 20:50 tmp

drwx------

2 root root 4096 Oct 30 22:28 trust

drwx------

2 root root 4096 Oct 30 22:28 volumes

Dockerfile是镜像的描述文件,定义了如何构建Docker镜像。Dockerfile需要到docker网站去查看:

查看方法如下:

1首先在网站上注册一个docker账号

2在上面的搜索栏中输入hello-world

3得到仓库中所有关于hello world的镜像,第一个就是我们下载的镜像

4点击进入后,会发现如下的dockerfile链接

5点击进入后跳转到github上的链接,可以看到hello-world的dockerfile写法

只有短短三条指令。

FROM scratch此镜像是从白手起家,从0开始构建。

COPY

hello /将文件“hello”复制到镜像的根目录。

CMD

["/hello"]容器启动时,执行/hello

镜像hello-world中就只有一个可执行文件 “hello”,其功能就是打印出 “Hello from Docker ......”等信息。

/hello就是文件系统的全部内容,连最基本的/bin,/usr, /lib, /dev都没有。 而/hello是根据hello.c编译而来的。可以点进去看下hello.c的内容,其实就是打印我们刚才执行docker run hello-world的内容。

docker hub上镜像手动下载_docker: docker安装和镜像下载相关推荐

  1. Docker入门系列之三:如何将dockerfile制作好的镜像发布到Docker hub上

    这个系列的前两篇文章,我们已经把我们的应用成功地在Docker里通过nginx运行了起来,并且用dockerfile里制作好了一个镜像. Docker入门系列之一:在一个Docker容器里运行指定的w ...

  2. 在Docker Hub上你可以很轻松下载到大量已经容器化的应用镜像,即拉即用——daocloud国内镜像加速...

    Docker之所以这么吸引人,除了它的新颖的技术外,围绕官方Registry(Docker Hub)的生态圈也是相当吸引人眼球的地方. 在Docker Hub上你可以很轻松下载到大量已经容器化的应用镜 ...

  3. Docker上部署SpringBoot项目并推送镜像到Docker Hub上---以MacOS为例

    Docker部署.镜像推送至Docker Hub.拉取.运行 Docker部署 Dockerfile文件内容 文件内容解释 制作镜像 查看镜像 本地运行镜像 镜像推送.拉取.运行 镜像推送 镜像拉取 ...

  4. docker发布自己的镜像到docker hub上

    当我们从拉取一个公有镜像,并且配置好开发环境,需要把这个镜像分享出去,供自己或者其他人拉取使用,这个时候就需要把自己的镜像推送到docker hub上了. 在dokcer hub官网上注册一个账号. ...

  5. 51 AVR 编程器USBASP下载器驱动安装及程序下载

    51 AVR 编程器USBASP下载器驱动安装及程序下载 下载器的介绍 驱动的下载 1.win10驱动的下载 其他系统驱动的安装 接线介绍 程序的下载 一.Progisp 的特点: 二.progisp ...

  6. docker hub上镜像手动下载_DockerHub 镜像直接下载

    DockerHub 镜像直接下载脚本js插件是由作者Code Hz分享的一个浏览器扩展插件.通过本脚本,给 Docker Hub 页面提供一个直接下载blobs的按钮. 什么是脚本? 脚本是批处理文件 ...

  7. Docker Hub上镜像发现挖矿蠕虫病毒,已导致2000台主机感染

    点击上方"民工哥技术之路"选择"星标" 每天10点为你分享不一样的干货   安全公司Palo Alto Networks威胁情报小组Unit 42发现一种新型的 ...

  8. 将镜像上传到Docker HUB上

    要将镜像上传到HUB上就必须注册一个DockerHUB的账号 HUB网址:https://hub.docker.com/ 注册好了之后,先创建一个仓库 回到docker上,如果之前已经pull了镜像并 ...

  9. docker添加新的环境变量_Docker的安装及部署Spring Boot项目操作详解!

    本文使用Docker部署Spring Boot项目.部署之前需要环境中已经安装Docker和Maven(用于打包),所以本文先进行安装Docker和Maven:接着搭建一个Spring Boot项目, ...

最新文章

  1. Myeclipse优化配置
  2. django1.4日志模块配置及使用
  3. php性能分析工具 - xhprof的安装使用
  4. 【codevs2011】【LNOI2013】最小距离之和
  5. Windows下使用动态库
  6. 创建WebSocket服务器
  7. 单片机数字滤波算法如何实现?(附代码)
  8. 关于低代码真实技术趋势,听低代码巨头 Mendix 怎么说
  9. java m2文件放哪里_windows下打开.m2文件夹,没有找到setting.xml
  10. linux原子方式,linux – 以原子方式移动目录
  11. 交互式、非交互式,登录式、非登录式Shell
  12. python的编程软件有哪些_python编程工具有哪些
  13. 双层pdf解析 java_java转双层pdf
  14. eplan步进电机_数控床子里电机用步进电机好还是伺服电机好?-工业支持中心-西门子中国...
  15. 技巧:Eclipse阿里代码规范插件
  16. 免费在线 Logo生成器
  17. 思维模型 帕累托法则
  18. 计算机用手机的网络,台式电脑如何使用手机网络上网
  19. python计算等额本金_等额本金还款计算公式
  20. 大厂面试预备篇——《两万字MySql基础总结》❤️建议收藏

热门文章

  1. vb.net——通过邮箱动态发送验证码实现完美注册
  2. ygo游戏王卡组_游戏王卡组教程系列【光道卡组】
  3. 用python打印沙漏_打印沙漏(20)
  4. HP ProLiant MicroServer Gen8 玩法汇总
  5. exFAT是支持Mac和Win的
  6. Cobo金库二代横空出世——全脱网、全开源、更安全
  7. Pycharm中的Python程序整体缩进、整体取消缩进
  8. Windows下的一些操作
  9. 计算机磁盘管理给优盘分区,u盘分区,教您怎么给U盘分区
  10. Blender建模模块:快速建一棵枯树