【基于Debian GNU/Linux 的docker debain-nginx搭建 (一)】

下载dockertoolbox 在windows下完了好几天,根据docker的官方文档配置,下载。早上下载nginx,搭载镜像出现各种平台兼容性问题,其中一个是 因为dockertoolbox用virtualbox构成虚拟环境,用dockerfile生成nginx镜像时,由于virtualbox的虚拟环境和windows 的平台不一致,配置文件无法共享。

所以解决方法如下:
1、要么进去virtualbox里面安一个SAMBA类似的软件
2、要么在linux下继续玩

忍无可忍,于是打开躺睡N久的vmware虚拟机,在centos 6.7下重新搞docker。

  1. 下载debian

    [root@localhost docker]# docker pull hub.c.163.com/public/debian:7.3-tools
    [root@localhost docker]# docker tag 9efe4315cdbc debian:7.3
    [root@localhost docker]# docker images

    REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
    debian 7.3 9efe4315cdbc 4 weeks ago 372.3 MB
    hub.c.163.com/public/debian 7.3-tools 9efe4315cdbc 4 weeks ago 372.3 MB

  2. [root@localhost docker]# docker run -i -t -p 8866:80 debian:7.3 /bin/bash

  3. 进入debain,下载nginx。

    apt-get update && apt-get install -y nginx

  4. 启动nginx

 /etc/init.d/nginx start

可以根据nginx status查看nginx的启动状态。
页面访问:
http://192.168.214.128:8866/
Welcome to nginx!
(192.168.214.128为宿主机ip),搞定!
![图片描述][2]

注:
1、apt-get install -y nginx 需要先apt-get update 源
2、此方法安装每次从centos中进debain,需要重新下载nginx(下个版本改进,基于dockerfile发布自己的镜像)


问题:
This question already has an answer here:
How do I fix the GPG error “NO_PUBKEY”? 10 answers
When I run the command:

sudo apt-get update
I got this following warning:

There is no public key available for the following key IDs: 1397BC53640DB551

解决办法:

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 1397BC53640DB551

    原文作者:DoINsiSt
    原文地址: https://segmentfault.com/a/1190000008849609
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞