文档章节

Ubuntu 14.04 Docker 草稿

kenzheng
 kenzheng
发布于 2015/12/18 11:06
字数 4083
阅读 65
收藏 0

待归档注释说明

Ubuntu 14.04安装Docker
http://www.linuxidc.com/Linux/2014-08/105656.htm

sudo apt-get install docker.io
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed:
      aufs-tools cgroup-lite git git-man liberror-perl
    Suggested packages:
      btrfs-tools debootstrap lxc rinse git-daemon-run git-daemon-sysvinit git-doc
      git-el git-email git-gui gitk gitweb git-arch git-bzr git-cvs git-mediawiki
      git-svn
    The following NEW packages will be installed:
      aufs-tools cgroup-lite docker.io git git-man liberror-perl
    0 upgraded, 6 newly installed, 0 to remove and 8 not upgraded.
    Need to get 7553 kB of archives.
    After this operation, 46.6 MB of additional disk space will be used.
    Do you want to continue? [Y/n] Y
    Get:1 http://cn.archive.ubuntu.com/ubuntu/ trusty/universe aufs-tools amd64 1:3.                                                                                               2+20130722-1.1 [92.3 kB]
    Get:2 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/universe docker.io amd                                                                                               64 1.0.1~dfsg1-0ubuntu1~ubuntu0.14.04.1 [4111 kB]
    Get:3 http://cn.archive.ubuntu.com/ubuntu/ trusty/main liberror-perl all 0.17-1.                                                                                               1 [21.1 kB]
    Get:4 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main git-man all 1:1.9                                                                                               .1-1ubuntu0.1 [698 kB]
    Get:5 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main git amd64 1:1.9.1                                                                                               -1ubuntu0.1 [2627 kB]
    Get:6 http://cn.archive.ubuntu.com/ubuntu/ trusty/main cgroup-lite all 1.9 [3918                                                                                                B]
    Fetched 7553 kB in 2min 15s (55.9 kB/s)
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
            LANGUAGE = "zh_CN:zh",
            LC_ALL = (unset),
            LC_TIME = "zh_CN",
            LC_MONETARY = "zh_CN",
            LC_ADDRESS = "zh_CN",
            LC_TELEPHONE = "zh_CN",
            LC_NAME = "zh_CN",
            LC_MEASUREMENT = "zh_CN",
            LC_IDENTIFICATION = "zh_CN",
            LC_NUMERIC = "zh_CN",
            LC_PAPER = "zh_CN",
            LANG = "zh_CN.UTF-8"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    Selecting previously unselected package aufs-tools.
    (Reading database ... 86456 files and directories currently installed.)
    Preparing to unpack .../aufs-tools_1%3a3.2+20130722-1.1_amd64.deb ...
    Unpacking aufs-tools (1:3.2+20130722-1.1) ...
    Selecting previously unselected package docker.io.
    Preparing to unpack .../docker.io_1.0.1~dfsg1-0ubuntu1~ubuntu0.14.04.1_amd64.deb                                                                                                ...
    Unpacking docker.io (1.0.1~dfsg1-0ubuntu1~ubuntu0.14.04.1) ...
    Selecting previously unselected package liberror-perl.
    Preparing to unpack .../liberror-perl_0.17-1.1_all.deb ...
    Unpacking liberror-perl (0.17-1.1) ...
    Selecting previously unselected package git-man.
    Preparing to unpack .../git-man_1%3a1.9.1-1ubuntu0.1_all.deb ...
    Unpacking git-man (1:1.9.1-1ubuntu0.1) ...
    Selecting previously unselected package git.
    Preparing to unpack .../git_1%3a1.9.1-1ubuntu0.1_amd64.deb ...
    Unpacking git (1:1.9.1-1ubuntu0.1) ...
    Selecting previously unselected package cgroup-lite.
    Preparing to unpack .../cgroup-lite_1.9_all.deb ...
    Unpacking cgroup-lite (1.9) ...
    Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
    Processing triggers for ureadahead (0.100.0-16) ...
    ureadahead will be reprofiled on next reboot
    Setting up aufs-tools (1:3.2+20130722-1.1) ...
    Setting up docker.io (1.0.1~dfsg1-0ubuntu1~ubuntu0.14.04.1) ...
    Adding group `docker' (GID 112) ...
    Done.
    docker.io start/running, process 3736
    Setting up liberror-perl (0.17-1.1) ...
    Setting up git-man (1:1.9.1-1ubuntu0.1) ...
    Setting up git (1:1.9.1-1ubuntu0.1) ...
    Setting up cgroup-lite (1.9) ...
    cgroup-lite start/running
    Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
    Processing triggers for ureadahead (0.100.0-16) ...
    
service docker.io status
    docker.io start/running, process 3736
service docker.io start
    start: Rejected send message, 1 matched rules; type="method_call", sender=":1.10" (uid=1000 pid=3876 comm="start docker.io ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init ")
ervice docker.io stop
    stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.12" (uid=1000 pid=3882 comm="stop docker.io ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init ")
service docker.io Stop
    * Docker is managed via upstart, try using service docker.io Stop

    创建软连接

sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
下面一个是搞什么,不知道,没执行
$ sudo sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io

sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
~$ sudo docker logs 3736
    2015/09/09 13:45:46 Error response from daemon: No such container: 3736
~$ sudo docker ps
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
~$ docker
    Usage: docker [OPTIONS] COMMAND [arg...]
     -H=[unix:///var/run/docker.sock]: tcp://host:port to bind/connect to or unix://path/to/socket to use

    A self-sufficient runtime for linux containers.

    Commands:
        attach    Attach to a running container
        build     Build an image from a Dockerfile
        commit    Create a new image from a container's changes
        cp        Copy files/folders from the containers filesystem to the host path
        diff      Inspect changes on a container's filesystem
        events    Get real time events from the server
        export    Stream the contents of a container as a tar archive
        history   Show the history of an image
        images    List images
        import    Create a new filesystem image from the contents of a tarball
        info      Display system-wide information
        inspect   Return low-level information on a container
        kill      Kill a running container
        load      Load an image from a tar archive
        login     Register or Login to the docker registry server
        logs      Fetch the logs of a container
        port      Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
        pause     Pause all processes within a container
        ps        List containers
        pull      Pull an image or a repository from the docker registry server
        push      Push an image or a repository to the docker registry server
        restart   Restart a running container
        rm        Remove one or more containers
        rmi       Remove one or more images
        run       Run a command in a new container
        save      Save an image to a tar archive
        search    Search for an image in the docker index
        start     Start a stopped container
        stop      Stop a running container
        tag       Tag an image into a repository
        top       Lookup the running processes of a container
        unpause   Unpause a paused container
        version   Show the docker version information
        wait      Block until a container stops, then print its exit code
    
http://os.51cto.com/art/201406/441321.htm
    当前Ubuntu 系统下的 Docker 的安装包只提供64位。如果你想运行32位的 Docker
    安装 Docker
    通过 apt-get 安装 Docker 简直是小菜一碟。
    $ sudo apt-get install docker.io
    如果你不是 root 组的用户,你可以把自己加入到 docker 用户组。下面的命令可以让没有 root 权限的用户使用 Docker:
    $ sudo usermod -a -G docker $USER
    重新登录,以便让你的用户组权限生效。
    下一步是编辑 Docker 配置文件,确定 Docker 可执行文件的路径:
    $ sudo vi /etc/default/docker.io
    DOCKER="/usr/bin/docker.io"
    重启 Docker 服务:
    $ sudo service docker.io restart
    管理 Docker Container 容器
    如果你想在新的 Docker 容器下创建一个新的 Ubuntu 操作系统,你首先需要 pull 一个 Ubuntu 的 Docker 镜像。下面的命令可以通过网络下载 Docker 镜像:
    $ docker pull ubuntu
    你可以使用下面的命令启动 Docker 里面的 Ubuntu 系统。最后的参数“/bin/bash”表示一旦容器启动,首先会执行简单的 bash。
    $ docker run -i -t ubuntu /bin/bash


sudo docker pull ubuntu
    Pulling repository ubuntu
    07f8e8c5e660: Pulling image (trusty-20150427) from ubuntu, endpoint: https://registry-1.docker.io/v1/
    2427658c75a1: Error pulling image (vivid-20150218) from ubuntu, EOF
    63e3c10217b8: Error pulling image (trusty-20150730) from ubuntu, EOF
    6be21d1e5d1e: Error pulling image (vivid-20150611) from ubuntu, EOF
    9610cfc68e8d: Error pulling image (precise-20150320) from ubuntu, EOF
    0fe5a10d2cf8: Error pulling image (wily-20150528.1) from ubuntu, EOF
    ab57dbafeeea: Error pulling image (utopic-20150612) from ubuntu, EOF
    2103b00b3fdf: Error pulling image (trusty-20150228.11) from ubuntu, EOF
    751a7482c0de: Error pulling image (vivid-20150319.1) from ubuntu, EOF
    fa81ed084842: Error pulling image (trusty-20150528) from ubuntu, EOF
    428b411c28f0: Error pulling dependent layers
    9d276fcfbea2: Error pulling dependent layers
    2015/09/09 13:52:21 Could not find repository on any of the indexed registries.
    
    
sudo docker pull ubuntu
    Pulling repository ubuntu
    07f8e8c5e660: Pulling image (trusty-20150427) from ubuntu, endpoint: https://registry-1.docker.io/v1/
    2427658c75a1: Error pulling image (vivid-20150218) from ubuntu, EOF
    .....
    428b411c28f0: Error pulling dependent layers
    9d276fcfbea2: Error pulling dependent layers
    Could not find repository on any of the indexed registries.

对了,我的docker 为什么安不成功?
sudo docker pull ubuntu
    Pulling repository ubuntu
    07f8e8c5e660: Pulling image (trusty-20150427) from ubuntu, endpoint: https://registry-1.docker.io/v1/
    2427658c75a1: Error pulling image (vivid-20150218) from ubuntu, EOF
    .....
    428b411c28f0: Error pulling dependent layers
    9d276fcfbea2: Error pulling dependent layers
    Could not find repository on any of the indexed registries.


ken@localhost:~$ sudo docker search tutorial
NAME                                       DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
learn/tutorial                                                                             13
georgeyord/reactjs-tutorial                This is the backend of the React comment b...   1                    [OK]
florentbenoit/docker-angularjs-tutorials                                                   1                    [OK]
odk211/spree-tutorial                                                                      1                    [OK]
neilellis/weave-multicast-tutorial                                                         0                    [OK]
delta2323/jnns2015-tutorial-gpu                                                            0                    [OK]
fabioberger/dockerize-tutorial                                                             0                    [OK]
pgrund/docker-tutorial                     docker-in-docker accessible by shellinabox      0                    [OK]
tobegit3hub/tutorial-beego                                                                 0                    [OK]
ianneub/rails-tutorial                                                                     0                    [OK]
ebutech/jupyter-cpa-tutorial               Jupyter with Node.js kernel + docker-compo...   0                    [OK]
msfuko/nodejs-tutorial                                                                     0                    [OK]
lmagnus/tutorials                                                                          0                    [OK]
mgalloy/docker-austin-tutorial-02                                                          0                    [OK]
li123456/tutorial                          tutorial                                        0
kedarvaidya/rails-tutorial-v3-dev                                                          0                    [OK]
wonderlamb/tutorial                        Tutorial                                        0
intrig/tutorial                                                                            0
jenniferw/whalesay-tutorial                tutorial for whalesay 2.0                       0
dhenry/tutorial-whale                      Repository image created in the Docker tut...   0
johnklee/tutorial                          Testing purpose                                 0
alectolytic/quagga-bgp-tutorial                                                            0                    [OK]
delta2323/jnns2015-tutorial                                                                0                    [OK]
cazcade/weave-multicast-tutorial                                                           0                    [OK]
sfilipov/rails-tutorial                                                                    0                    [OK]
ken@localhost:~$ sudo docker search ubuntu
NAME                           DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                         Ubuntu is a Debian-based Linux operating s...   2243      [OK]
ubuntu-upstart                 Upstart is an event-based replacement for ...   32        [OK]
torusware/speedus-ubuntu       Always updated official Ubuntu docker imag...   25                   [OK]
tleyden5iwx/ubuntu-cuda        Ubuntu 14.04 with CUDA drivers pre-installed    18                   [OK]
ubuntu-debootstrap             debootstrap --variant=minbase --components...   12        [OK]
rastasheep/ubuntu-sshd         Dockerized SSH service, built on top of of...   10                   [OK]
guilhem/vagrant-ubuntu                                                         10                   [OK]
fike/ubuntu-postgresql         PostgreSQL 9.4 beta until 9.0 version runn...   4                    [OK]
n3ziniuka5/ubuntu-oracle-jdk   Ubuntu with Oracle JDK. Check tags for ver...   3                    [OK]
nimmis/ubuntu                  This is a docker images different LTS vers...   3                    [OK]
sameersbn/ubuntu                                                               3                    [OK]
nuagebec/ubuntu                Simple always updated Ubuntu docker images...   2                    [OK]
maxexcloo/ubuntu               Docker base image built on Ubuntu with Sup...   2                    [OK]
baselibrary/ubuntu             ThoughtWorks Ubuntu Docker Image                1                    [OK]
seetheprogress/ubuntu          Ubuntu image provided by seetheprogress us...   1                    [OK]
densuke/ubuntu-jp-remix        Ubuntu Linuxの日本語remix風味です                       1                    [OK]
sylvainlasnier/ubuntu          Ubuntu 15.04 root docker images with commo...   1                    [OK]
isuper/base-ubuntu             This is just a small and clean base Ubuntu...   1                    [OK]
cpuguy83/ubuntu                                                                1                    [OK]
vicamo/ubuntu-phablet-jiexi    Dockerfile for developing Ubuntu JieXi PDK.     0                    [OK]
densuke/ubuntu-supervisor      densuke/ubuntu-jp-remix:trusty 上で supe...       0                    [OK]
zoni/ubuntu                                                                    0                    [OK]
partlab/ubuntu                 Simple Ubuntu docker images.                    0                    [OK]
gbevan/ubuntu-foreman          Ubuntu based Puppet Foreman with Ansible        0                    [OK]
esycat/ubuntu                  Ubuntu LTS                                      0                    [OK]
ken@localhost:~$ sudo docker search mysql
]NAME                         DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
mysql                        MySQL is a widely used, open-source relati...   1028      [OK]
mysql/mysql-server           Optimized MySQL Server Docker images. Crea...   41                   [OK]
orchardup/mysql                                                              41                   [OK]
centurylink/mysql            Image containing mysql. Optimized to be li...   26                   [OK]
wnameless/mysql-phpmyadmin   MySQL + phpMyAdmin https://index.docker.io...   22                   [OK]
sameersbn/mysql                                                              20                   [OK]
google/mysql                 MySQL server for Google Compute Engine          13                   [OK]
appcontainers/mysql          CentOS 6.7 based Customizible MySQL 5.5 Co...   5                    [OK]
jdeathe/centos-ssh-mysql     CentOS-6 6.6 x86_64 / MySQL.                    2                    [OK]
marvambass/mysql             MySQL Server based on Ubuntu 14.04              2                    [OK]
azukiapp/mysql               Docker image to run MySQL by Azuki - http:...   2                    [OK]
frodenas/mysql               A Docker Image for MySQL                        1                    [OK]
ibourgeois/mysql             MySQL image from ibourgeois/base                1                    [OK]
bahmni/mysql                 Mysql container for bahmni.  Contains the ...   1                    [OK]
phpmentors/mysql             MySQL server image                              1                    [OK]
jmoati/mysql                                                                 0                    [OK]
ahmet2mir/mysql              This is a Debian based image with MySQL se...   0                    [OK]
vkyii/mysql                  mysql base on alpine                            0                    [OK]
withinboredom/mysql          A MySQL container using s6 and Consul -- b...   0                    [OK]
guihatano/mysql              MySQL Server on Ubuntu 14.04                    0                    [OK]
tetraweb/mysql                                                               0                    [OK]
wenzizone/mysql              mysql                                           0                    [OK]
lancehudson/docker-mysql     MySQL is a widely used, open-source relati...   0                    [OK]
dockerizedrupal/mysql        docker-mysql                                    0                    [OK]
jav13r/mysql                 mysql                                           0                    [OK]
ken@localhost:~$ sudo docker search jdk
NAME                                      DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ingensi/oracle-jdk                        Official Oracle JDK installed on centos.        16                   [OK]
jboss/base-jdk                                                                            10                   [OK]
errordeveloper/oracle-jdk                 A minimalistic Oracle JDK 8 container on t...   9                    [OK]
hanswesterbeek/google-debian-oracle-jdk   Oracle's JDK installed on top of Google's ...   8                    [OK]
n3ziniuka5/ubuntu-oracle-jdk              Ubuntu with Oracle JDK. Check tags for ver...   3                    [OK]
ksdn117/oracle-jdk                        Oracle's JDK on Ubuntu                          2                    [OK]
delitescere/jdk                           Minimal Zulu OpenJDK                            2                    [OK]
airdock/oracle-jdk                        Docker Image for Oracle Java 8 and 7            2                    [OK]
qcdatainc/centos-jdk                      CentOS with JDK installed                       2                    [OK]
melinite/oracle-java8-jdk                 Barebones WebUpd8 Oracle Java 8 JDK + goog...   2                    [OK]
xavier268/jdk8                            JDK8 on latest CENTOS                           2                    [OK]
nderwin/docker-jdk                        Docker JDK Image                                1                    [OK]
phedoreanu/archlinux-oracle-jdk           Docker baseline image with Archlinux + Ora...   1                    [OK]
sscheffler/jdk                            Oracle JDKs (jdk 7 and jdk 8)                   0                    [OK]
drokar/centos-oracle-jdk                  centOS with Oracle jdk                          0                    [OK]
vaysman/jdk                               Latest Ubuntu with JDK                          0                    [OK]
dynamind/oracle-jdk                                                                       0                    [OK]
amarkwalder/base-jdk-8                    base-jdk-8                                      0                    [OK]
tibux/slackware-jdk                                                                       0                    [OK]
edwxie/jdk                                Base JDK Image                                  0                    [OK]
razzek/jdk                                jdk 8 with a default service user               0                    [OK]
cnry/jdk                                  OpenJDK 7 on Debian Jessie                      0                    [OK]
ramkicse/jdk                              Oracle JDK 1.8 u45 based on Centos 7            0                    [OK]
redspark/oracle-jdk                       Base container running debian with oracle jdk   0                    [OK]
pojoict/jdk                               Oracle jdk image based on pojoict/base.         0                    [OK]
ken@localhost:~$ sudo docker search tomcat
NAME                                        DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
tomcat                                      Apache Tomcat is an open source implementa...   251       [OK]
consol/tomcat-7.0                           Tomcat 7.0.57, 8080, "admin/admin"              12                   [OK]
consol/tomcat-8.0                           Tomcat 8.0.15, 8080, "admin/admin"              11                   [OK]
dordoka/tomcat                              Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 ba...   7                    [OK]
consol/tomcat-6.0                           Tomcat 6.0.43, 8080, "admin/admin"              6                    [OK]
consol/tomcat-4.1                           Tomcat 4.1.40, 8080, "admin/admin"              4                    [OK]
consol/tomcat-5.0                           Tomcat 5.0.30,  8080, "admin/admin"             4                    [OK]
lucee/lucee-tomcat                          Lucee on Tomcat 7.0.63-jre8 (JAR deployment)    4                    [OK]
consol/tomcat-5.5                           Tomcat 5.5.36, 8080, "admin/admin"              4                    [OK]
consol/tomcat-3.3                           Tomcat 3.3.2, 8080, "admin/admin"               4                    [OK]
malderhout/tomcat                           Tomcat7 with OpenJDK7 on CentOS7                3                    [OK]
kieker/tomcat                                                                               2                    [OK]
cloudesire/tomcat                           Tomcat server 6/7/8 with oracle java 7/8 o...   2                    [OK]
emedeiros/tomcat                            Apache Tomcat/8.0.24 with OpenJDK 8             1                    [OK]
ericogr/tomcat                              Tomcat 8, 8080, "docker/docker"                 1                    [OK]
nicescale/tomcat                            Tomcat service for NiceScale. http://nices...   1                    [OK]
dynamind/tomcat                                                                             0                    [OK]
learninglayers/tomcat                                                                       0                    [OK]
foobot/tomcat                                                                               0                    [OK]
inspectit/tomcat                            Tomcat with inspectIT                           0                    [OK]
purban/tomcat                               Tomcat 7 and Centos 7 Onbuild image             0                    [OK]
radiantbluetechnologies/rialtobase-tomcat   rialtobase-tomcat                               0                    [OK]
andreluiznsilva/tomcat                                                                      0                    [OK]
jpierre03/tomcat                                                                            0                    [OK]
extvos/tomcat                               Tomcat on Docker                                0                    [OK]
ken@localhost:~$ sudo docker search nginx
NAME                                  DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
nginx                                 Official build of Nginx.                        1332      [OK]
jwilder/nginx-proxy                   Automated Nginx reverse proxy for docker c...   340                  [OK]
richarvey/nginx-php-fpm               Container running Nginx + PHP-FPM capable ...   69                   [OK]
maxexcloo/nginx-php                   Docker framework container with Nginx and ...   45                   [OK]
marvambass/nginx-registry-proxy       Docker Registry Reverse Proxy with Basic A...   22                   [OK]
million12/nginx-php                   Nginx + PHP-FPM 5.5, 5.6, 7.0 (NG), CentOS...   18                   [OK]
tlongren/docker-wordpress-nginx-ssh   Latest WordPress with Nginx, PHP-APC, PHP-...   14                   [OK]
h3nrik/nginx-ldap                     NGINX web server with LDAP/AD, SSL and pro...   12                   [OK]
bitnami/nginx                         Bitnami nginx Docker Image                      7                    [OK]
maxexcloo/nginx                       Docker framework container with Nginx inst...   6                    [OK]
zenithar/nano-nginx                   Nano NGiNX Container, compiled from scratch.    5                    [OK]
million12/nginx                       Nginx: extensible, nicely tuned for better...   4                    [OK]
devries/nginx                         A standard ubuntu nginx installation with ...   4                    [OK]
klaemo/nginx                          nginx 1.7.0 (mainline)                          1                    [OK]
radial/nginx                          Spoke container for Nginx, a high performa...   1                    [OK]
desertbit/nginx                       Deploy Nginx with some useful presets avai...   1                    [OK]
dock0/nginx                           Arch container running nginx                    1                    [OK]
abevoelker/nginx                      nginx                                           1                    [OK]
1science/nginx                        Nginx Docker images based on Alpine Linux       0                    [OK]
verbling/nginx                        configured nginx container                      0                    [OK]
aegypius/nginx                        confd managed nginx reverse proxy               0                    [OK]
unblibraries/nginx                    Baseline non-PHP nginx container                0                    [OK]
mariorez/nginx                        Base Container for Nginx                        0                    [OK]
densuke/nginx-php5                    NginxとPHP5を使えるように調整し...                         0                    [OK]
envygeeks/nginx                       Nginx (latest) image.                           0                    [OK]
ken@localhost:~$

learn/tutorial
ubuntu                         Ubuntu is a Debian-based Linux operating s...   2243      [OK]
mysql                        MySQL is a widely used, open-source relati...   1028      [OK]
ingensi/oracle-jdk                        Official Oracle JDK installed on centos.        16                   [OK]
consol/tomcat-7.0                           Tomcat 7.0.57, 8080, "admin/admin"              12                   [OK]
nginx                                 Official build of Nginx.                        1332      [OK]


sudo docker pull learn/tutorial       error
sudo docker pull mysql            error
sudo docker pull nginx
sudo docker pull mattdm/fedora

docker run命令有两个参数,一个是镜像名,一个是要在镜像中运行的命令。
正确的命令:
$docker run learn/tutorial echo "hello word"


在执行apt-get 命令的时候,要带上-y参数。如果不指定-y参数的话,apt-get命令会进入交互模式,需要用户输入命令来进行确认,但在docker环境中是无法响应这种交互的。
正确的命令:
$docker run learn/tutorial apt-get install -y ping
命令来安装ping程序:apt-get install -y ping。    备注:apt-get 命令执行完毕之后,容器就会停止,但对容器的改动不会丢失。

保存对容器的修改
    当你对某一个容器做了修改之后(通过在容器中运行某一个命令),可以把对容器的修改保存下来,这样下次可以从保存后的最新状态运行该容器。docker中保存状态的过程称之为committing,它保存的新旧状态之间的区别,从而产生一个新的版本。
    目标:
        首先使用docker ps -l命令获得安装完ping命令之后容器的id。然后把这个镜像保存为learn/ping。
    提示:
    1. 运行docker commit,可以查看该命令的参数列表。
    2. 你需要指定要提交保存容器的ID。(译者按:通过docker ps -l 命令获得)
    3. 无需拷贝完整的id,通常来讲最开始的三至四个字母即可区分。(译者按:非常类似git里面的版本号)
    正确的命令:
    $docker commit 698 learn/ping

运行新的镜像
    ok,到现在为止,你已经建立了一个完整的、自成体系的docker环境,并且安装了ping命令在里面。它可以在任何支持docker环境的系统中运行啦!(译者按:是不是很神奇呢?)让我们来体验一下吧!
    目标:
    在新的镜像中运行ping www.google.com命令。
    提示:
    一定要使用新的镜像名learn/ping来运行ping命令。(译者按:最开始下载的learn/tutorial镜像中是没有ping命令的)
    正确的命令:
    $docker run lean/ping ping www.google.com

检查运行中的镜像
    现在你已经运行了一个docker容器,让我们来看下正在运行的容器。
    使用docker ps命令可以查看所有正在运行中的容器列表,使用docker inspect命令我们可以查看更详细的关于某一个容器的信息。
    目标:
    查找某一个运行中容器的id,然后使用docker inspect命令查看容器的信息。
    提示:
    可以使用镜像id的前面部分,不需要完整的id。
    正确的命令:
    $ docker inspect efe
    
发布docker镜像
    现在我们已经验证了新镜像可以正常工作,下一步我们可以将其发布到官方的索引网站。还记得我们最开始下载的learn/tutorial镜像吧,我们也可以把我们自己编译的镜像发布到索引页面,一方面可以自己重用,另一方面也可以分享给其他人使用。
    目标:
    把learn/ping镜像发布到docker的index网站。
    提示:
    1. docker images命令可以列出所有安装过的镜像。
    2. docker push命令可以将某一个镜像发布到官方网站。
    3. 你只能将镜像发布到自己的空间下面。这个模拟器登录的是learn帐号。
    预期的命令:
    $ docker push learn/ping
    
公司网络限制,必须通过proxy代理上网。
http://blog.csdn.net/halcyonbaby/article/details/39475765
    使用docker pull时一直出现如下错误:
    [root@centoo65 ~]# sudo HTTP_PROXY=http://186.100.4.107:808/ docker pull busybox
    Pulling repository busybox
    2014/09/21 23:54:08 Get https://index.docker.io/v1/repositories/busybox/images: dial tcp: lookup index.docker.io: no such host

    解决办法(以centos为例,其他系统类似):
    修改/etc/sysconfig/docker
    HTTP_PROXY=http://186.100.4.107:808
    http_proxy=$HTTP_PROXY
    HTTPS_PROXY=$HTTP_PROXY
    https_proxy=$HTTP_PROXY
    export HTTP_PROXY HTTPS_PROXY http_proxy https_proxy


Ubuntu 14.04版本无需安装额外的依赖包,可以直接安装。
安装步骤:
    使用管理员帐号登录ubuntu 14.04系统,保证该管理有root权限,或者可以执行sudo命令。
    检查curl包有没有安装。
    $ which curl
    如果curl没有安装的话,更新apt源之后,安装curl包。
    $ sudo apt-get update $ sudo apt-get install curl
    获得最新的docker安装包。
    $ curl -sSL https://get.docker.com/ | sh
    shell会提示你输入sudo的密码,然后开始执行安装过程。
    确认Docker是否安装成功。
    $ sudo docker run hello-world
    这个命令会下载一个测试用的镜像并启动一个容器运行它。


$ sudo docker pull learn/tutorial
Pulling repository learn/tutorial
8dbd9e392a96: Error pulling image (latest) from learn/tutorial, EOF
2015/09/14 12:23:01 Could not find repository on any of the indexed registries.
~$ sudo docker pull mysql
Pulling repository mysql
2015/09/14 12:25:11 Get https://index.docker.io/v1/repositories/mysql/images: read tcp 54.85.252.127:443: i/o timeout
~$ sudo docker pull nginx
Pulling repository nginx
2015/09/14 12:28:20 Get https://index.docker.io/v1/repositories/nginx/images: read tcp 54.175.225.167:443: i/o timeout


© 著作权归作者所有

kenzheng
粉丝 7
博文 91
码字总数 111560
作品 0
武汉
高级程序员
私信 提问
docker学习笔记(1)

(1)Docker介绍 关于Docker的介绍,我就不列举出来了。到百度、谷歌搜索。非常多介绍文章。以下我给出官网的介绍:https://www.docker.com/whatisdocker/ (2)体验Docker Docker官网提供了...

技术mix呢
2017/10/19
0
0
Docker实战(一)之使用Docker镜像

镜像是Docker三大核心概念中最为重要的,自Docker诞生之日起“镜像”就是相关社区最为热门的关键字。 Docker运行容器前需要本地存在对应的镜像,如果镜像没有保存至本地,Docker会尝试先从默...

youcongtech
2018/07/07
0
0
深入分析Docker镜像原理(上)

第一部分:Docker镜像的基本知识 1.1 什么是Docker镜像 从整体的角度来讲,一个完整的Docker镜像可以支撑一个Docker容器的运行,在 Docker容器运行过程中主要提供文件系统视角。例如一个ubu...

苏宁公有云
2015/08/24
0
0
docker入门与实践之【06-其他镜像制作方式】

1.从压缩包导入 格式: 可以使用history命令查询构建记录: 2. 和 使用 docker save 命令可以将镜像保存为归档文件。 比如我们希望保存这个 alpine 镜像。 保存镜像的命令为: 然后我们将 al...

Funcy1122
2018/06/08
0
0
一次完整的Docker实作

一次完整的Docker实作 说了那么多后,我们必须亲自动手玩了。下面把pull,run,build,push都玩一次,破除神秘感。一个典型的运行流程如下: 1. client用pull命令从仓库把image拉到docker ho...

安好52199
2017/03/09
0
0

没有更多内容

加载失败,请刷新页面

加载更多

springmvc java对象转json,上传下载(未完)拦截器Interceptor以及源码解析(未完待续)

package com.atguigu.my.controller;import java.util.Collection;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Contr......

architect刘源源
今天
26
0
[日更-2019.5.24、25、26] Android系统中的Binder通信机制分析(一)--servicemanager

声明 其实对于Android系统Binder通信的机制早就有分析的想法,记得去年6、7月份Mr.Deng离职期间约定一起对其进行研究的,但因为我个人问题没能实施这个计划,留下些许遗憾... 最近,刚好在做...

Captain_小馬佩德罗
昨天
24
0
聊聊dubbo的DataStore

序 本文主要研究一下dubbo的DataStore DataStore dubbo-2.7.2/dubbo-common/src/main/java/org/apache/dubbo/common/store/DataStore.java @SPI("simple")public interface DataStore { ......

go4it
昨天
3
0
17.windows上安装kafka并简单应用

参考:https://blog.csdn.net/yao8513277/article/details/81116718 1.单机版 1.1 安装jdk 略 1.2 安装zookeeper https://my.oschina.net/springMVCAndspring/blog/3045210 1.3 安装window上......

20190513
昨天
2
0
缓存雪崩

缓存雪崩原因:大批次的缓存数据,同一时刻过期 解决方案: 1、尽可能避免所有缓存在同一时刻过期,即:合理调整过期策略 2、对条件加锁 伪代码: public ProductselectProduct(String id){ ...

少年已不再年少
昨天
10
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部