Merge pull request #1404 from dnordberg/fix-base-refs

'Base' image is depreciated and should no longer be referenced in the docs.
This commit is contained in:
Andy Rothfusz 2013-08-05 13:24:05 -07:00
commit dcc1e3562f
6 changed files with 46 additions and 46 deletions

View File

@ -15,8 +15,8 @@ Download the base container
.. code-block:: bash .. code-block:: bash
# Download a base image # Download an ubuntu image
docker pull base docker pull ubuntu
The *base* image is a minimal *ubuntu* based container, alternatively you can select *busybox*, a bare The *base* image is a minimal *ubuntu* based container, alternatively you can select *busybox*, a bare
minimal linux system. The images are retrieved from the docker repository. minimal linux system. The images are retrieved from the docker repository.
@ -47,4 +47,4 @@ See the example in action
</div> </div>
Continue to the :ref:`hello_world_daemon` example. Continue to the :ref:`hello_world_daemon` example.

View File

@ -11,20 +11,20 @@ Hello World Daemon
The most boring daemon ever written. The most boring daemon ever written.
This example assumes you have Docker installed and with the base image already imported ``docker pull base``. This example assumes you have Docker installed and with the ubuntu image already imported ``docker pull ubuntu``.
We will use the base image to run a simple hello world daemon that will just print hello world to standard We will use the ubuntu image to run a simple hello world daemon that will just print hello world to standard
out every second. It will continue to do this until we stop it. out every second. It will continue to do this until we stop it.
**Steps:** **Steps:**
.. code-block:: bash .. code-block:: bash
CONTAINER_ID=$(docker run -d base /bin/sh -c "while true; do echo hello world; sleep 1; done") CONTAINER_ID=$(docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done")
We are going to run a simple hello world daemon in a new container made from the base image. We are going to run a simple hello world daemon in a new container made from the ubuntu image.
- **"docker run -d "** run a command in a new container. We pass "-d" so it runs as a daemon. - **"docker run -d "** run a command in a new container. We pass "-d" so it runs as a daemon.
- **"base"** is the image we want to run the command inside of. - **"ubuntu"** is the image we want to run the command inside of.
- **"/bin/sh -c"** is the command we want to run in the container - **"/bin/sh -c"** is the command we want to run in the container
- **"while true; do echo hello world; sleep 1; done"** is the mini script we want to run, that will just print hello world once a second until we stop it. - **"while true; do echo hello world; sleep 1; done"** is the mini script we want to run, that will just print hello world once a second until we stop it.
- **$CONTAINER_ID** the output of the run command will return a container id, we can use in future commands to see what is going on with this process. - **$CONTAINER_ID** the output of the run command will return a container id, we can use in future commands to see what is going on with this process.

View File

@ -34,12 +34,12 @@ The password is 'screencast'
.. code-block:: bash .. code-block:: bash
# Hello! We are going to try and install openssh on a container and run it as a servic # Hello! We are going to try and install openssh on a container and run it as a servic
# let's pull base to get a base ubuntu image. # let's pull ubuntu to get a base ubuntu image.
$ docker pull base $ docker pull ubuntu
# I had it so it was quick # I had it so it was quick
# now let's connect using -i for interactive and with -t for terminal # now let's connect using -i for interactive and with -t for terminal
# we execute /bin/bash to get a prompt. # we execute /bin/bash to get a prompt.
$ docker run -i -t base /bin/bash $ docker run -i -t ubuntu /bin/bash
# now let's commit it # now let's commit it
# which container was it? # which container was it?
$ docker ps -a |more $ docker ps -a |more

View File

@ -26,12 +26,12 @@ Running an interactive shell
.. code-block:: bash .. code-block:: bash
# Download a base image # Download an ubuntu image
docker pull base docker pull ubuntu
# Run an interactive shell in the base image, # Run an interactive shell in the ubuntu image,
# allocate a tty, attach stdin and stdout # allocate a tty, attach stdin and stdout
docker run -i -t base /bin/bash docker run -i -t ubuntu /bin/bash
Bind Docker to another host/port or a unix socket Bind Docker to another host/port or a unix socket
------------------------------------------------- -------------------------------------------------
@ -52,8 +52,8 @@ For example:
# Run docker in daemon mode # Run docker in daemon mode
sudo <path to>/docker -H 0.0.0.0:5555 -d & sudo <path to>/docker -H 0.0.0.0:5555 -d &
# Download a base image # Download an ubuntu image
docker -H :5555 pull base docker -H :5555 pull ubuntu
You can use multiple -H, for example, if you want to listen You can use multiple -H, for example, if you want to listen
on both tcp and a unix socket on both tcp and a unix socket
@ -62,10 +62,10 @@ on both tcp and a unix socket
# Run docker in daemon mode # Run docker in daemon mode
sudo <path to>/docker -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock -d & sudo <path to>/docker -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock -d &
# Download a base image # Download an ubuntu image
docker pull base docker pull ubuntu
# OR # OR
docker -H unix:///var/run/docker.sock pull base docker -H unix:///var/run/docker.sock pull ubuntu
Starting a long-running worker process Starting a long-running worker process
-------------------------------------- --------------------------------------
@ -73,7 +73,7 @@ Starting a long-running worker process
.. code-block:: bash .. code-block:: bash
# Start a very useful long-running process # Start a very useful long-running process
JOB=$(docker run -d base /bin/sh -c "while true; do echo Hello world; sleep 1; done") JOB=$(docker run -d ubuntu /bin/sh -c "while true; do echo Hello world; sleep 1; done")
# Collect the output of the job so far # Collect the output of the job so far
docker logs $JOB docker logs $JOB
@ -95,7 +95,7 @@ Expose a service on a TCP port
.. code-block:: bash .. code-block:: bash
# Expose port 4444 of this container, and tell netcat to listen on it # Expose port 4444 of this container, and tell netcat to listen on it
JOB=$(docker run -d -p 4444 base /bin/nc -l -p 4444) JOB=$(docker run -d -p 4444 ubuntu /bin/nc -l -p 4444)
# Which public port is NATed to my container? # Which public port is NATed to my container?
PORT=$(docker port $JOB 4444) PORT=$(docker port $JOB 4444)

View File

@ -53,13 +53,13 @@ defined type which can be used like so:
.. code-block:: ruby .. code-block:: ruby
docker::image { 'base': } docker::image { 'ubuntu': }
This is equivalent to running: This is equivalent to running:
.. code-block:: bash .. code-block:: bash
docker pull base docker pull ubuntu
Note that it will only if the image of that name does not already exist. Note that it will only if the image of that name does not already exist.
This is downloading a large binary so on first run can take a while. This is downloading a large binary so on first run can take a while.
@ -68,7 +68,7 @@ for exec. Note that you can also remove images you no longer need with:
.. code-block:: ruby .. code-block:: ruby
docker::image { 'base': docker::image { 'ubuntu':
ensure => 'absent', ensure => 'absent',
} }
@ -81,7 +81,7 @@ docker.
.. code-block:: ruby .. code-block:: ruby
docker::run { 'helloworld': docker::run { 'helloworld':
image => 'base', image => 'ubuntu',
command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"', command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
} }
@ -89,14 +89,14 @@ This is equivalent to running the following command, but under upstart:
.. code-block:: bash .. code-block:: bash
docker run -d base /bin/sh -c "while true; do echo hello world; sleep 1; done" docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
Run also contains a number of optional parameters: Run also contains a number of optional parameters:
.. code-block:: ruby .. code-block:: ruby
docker::run { 'helloworld': docker::run { 'helloworld':
image => 'base', image => 'ubuntu',
command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"', command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
ports => ['4444', '4555'], ports => ['4444', '4555'],
volumes => ['/var/lib/counchdb', '/var/log'], volumes => ['/var/lib/counchdb', '/var/log'],

View File

@ -146,7 +146,7 @@ cd docker\-master
.sp .sp
.nf .nf
.ft C .ft C
sudo ./docker run \-i \-t base /bin/bash sudo ./docker run \-i \-t ubuntu /bin/bash
.ft P .ft P
.fi .fi
.sp .sp
@ -496,22 +496,22 @@ This is the most basic example available for using docker
.sp .sp
This example assumes you have Docker installed. This example assumes you have Docker installed.
.sp .sp
Download the base container Download the ubuntu container
.sp .sp
.nf .nf
.ft C .ft C
# Download a base image # Download an ubuntu image
docker pull base docker pull ubuntu
.ft P .ft P
.fi .fi
.sp .sp
The \fIbase\fP image is a minimal \fIubuntu\fP based container, alternatively you can select \fIbusybox\fP, a bare Alternatively you can select \fIbusybox\fP, a bare minimal linux system. The
minimal linux system. The images are retrieved from the docker repository. images are retrieved from the docker repository.
.sp .sp
.nf .nf
.ft C .ft C
#run a simple echo command, that will echo hello world back to the console over standard out. #run a simple echo command, that will echo hello world back to the console over standard out.
docker run base /bin/echo hello world docker run ubuntu /bin/echo hello world
.ft P .ft P
.fi .fi
.sp .sp
@ -520,7 +520,7 @@ docker run base /bin/echo hello world
.IP \(bu 2 .IP \(bu 2
\fB"docker run"\fP run a command in a new container \fB"docker run"\fP run a command in a new container
.IP \(bu 2 .IP \(bu 2
\fB"base"\fP is the image we want to run the command inside of. \fB"ubuntu"\fP is the image we want to run the command inside of.
.IP \(bu 2 .IP \(bu 2
\fB"/bin/echo"\fP is the command we want to run in the container \fB"/bin/echo"\fP is the command we want to run in the container
.IP \(bu 2 .IP \(bu 2
@ -536,15 +536,15 @@ Continue to the \fIhello_world_daemon\fP example.
.sp .sp
The most boring daemon ever written. The most boring daemon ever written.
.sp .sp
This example assumes you have Docker installed and with the base image already imported \fBdocker pull base\fP. This example assumes you have Docker installed and with the ubuntu image already imported \fBdocker pull ubuntu\fP.
We will use the base image to run a simple hello world daemon that will just print hello world to standard We will use the ubuntu image to run a simple hello world daemon that will just print hello world to standard
out every second. It will continue to do this until we stop it. out every second. It will continue to do this until we stop it.
.sp .sp
\fBSteps:\fP \fBSteps:\fP
.sp .sp
.nf .nf
.ft C .ft C
$ CONTAINER_ID=$(docker run \-d base /bin/sh \-c "while true; do echo hello world; sleep 1; done") $ CONTAINER_ID=$(docker run \-d ubuntu /bin/sh \-c "while true; do echo hello world; sleep 1; done")
.ft P .ft P
.fi .fi
.sp .sp
@ -553,7 +553,7 @@ We are going to run a simple hello world daemon in a new container made from the
.IP \(bu 2 .IP \(bu 2
\fB"docker run \-d "\fP run a command in a new container. We pass "\-d" so it runs as a daemon. \fB"docker run \-d "\fP run a command in a new container. We pass "\-d" so it runs as a daemon.
.IP \(bu 2 .IP \(bu 2
\fB"base"\fP is the image we want to run the command inside of. \fB"ubuntu"\fP is the image we want to run the command inside of.
.IP \(bu 2 .IP \(bu 2
\fB"/bin/sh \-c"\fP is the command we want to run in the container \fB"/bin/sh \-c"\fP is the command we want to run in the container
.IP \(bu 2 .IP \(bu 2
@ -766,12 +766,12 @@ Contents:
.sp .sp
.nf .nf
.ft C .ft C
# Download a base image # Download an ubuntu image
docker import base docker import ubuntu
# Run an interactive shell in the base image, # Run an interactive shell in the ubuntu image,
# allocate a tty, attach stdin and stdout # allocate a tty, attach stdin and stdout
docker run \-a \-i \-t base /bin/bash docker run \-a \-i \-t ubuntu /bin/bash
.ft P .ft P
.fi .fi
.SS Starting a long\-running worker process .SS Starting a long\-running worker process
@ -782,7 +782,7 @@ docker run \-a \-i \-t base /bin/bash
(docker \-d || echo "Docker daemon already running") & (docker \-d || echo "Docker daemon already running") &
# Start a very useful long\-running process # Start a very useful long\-running process
JOB=$(docker run base /bin/sh \-c "while true; do echo Hello world!; sleep 1; done") JOB=$(docker run ubuntu /bin/sh \-c "while true; do echo Hello world!; sleep 1; done")
# Collect the output of the job so far # Collect the output of the job so far
docker logs $JOB docker logs $JOB
@ -803,7 +803,7 @@ docker ps
.nf .nf
.ft C .ft C
# Expose port 4444 of this container, and tell netcat to listen on it # Expose port 4444 of this container, and tell netcat to listen on it
JOB=$(docker run \-p 4444 base /bin/nc \-l \-p 4444) JOB=$(docker run \-p 4444 ubuntu /bin/nc \-l \-p 4444)
# Which public port is NATed to my container? # Which public port is NATed to my container?
PORT=$(docker port $JOB 4444) PORT=$(docker port $JOB 4444)