moby--moby/docs/sources/documentation/examples/hello_world.rst

50 lines
1.2 KiB
ReStructuredText
Raw Normal View History

:title: Docker: Hello world example
:description: A simple hello world example with Docker
:keywords: docker, example, hello world
.. _hello_world:
Hello World
===========
This is the most basic example available for using docker
2013-03-27 01:21:52 +00:00
This example assumes you have Docker installed.
Download the base container
.. code-block:: bash
# Download a base image
docker pull base
The *base* image is a minimal Debian based container, alternatively you can select *busybox*, a bare
minimal linux system. The images are retrieved from the docker repository.
.. code-block:: bash
2013-03-27 01:21:52 +00:00
#run a simple echo command, that will echo hello world back to the console over standard out.
docker run base /bin/echo hello world
**Explanation:**
- **"docker run"** run a command in a new container
2013-03-27 01:21:52 +00:00
- **"base"** is the image we want to run the command inside of.
- **"/bin/echo"** is the command we want to run in the container
- **"hello world"** is the input for the echo command
2013-03-27 01:21:52 +00:00
**Video:**
See the example in action
.. raw:: html
<div style="margin-top:10px;">
2013-03-27 01:21:52 +00:00
<iframe width="560" height="350" src="http://ascii.io/a/2603/raw" frameborder="0"></iframe>
</div>
2013-03-27 01:21:52 +00:00
Continue to the :ref:`hello_world_daemon` example.