hello_world.rst 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. :title: Hello world example
  2. :description: A simple hello world example with Docker
  3. :keywords: docker, example, hello world
  4. .. _hello_world:
  5. Hello World
  6. ===========
  7. .. include:: example_header.inc
  8. This is the most basic example available for using Docker.
  9. Download the base image (named "ubuntu"):
  10. .. code-block:: bash
  11. # Download an ubuntu image
  12. sudo docker pull ubuntu
  13. Alternatively to the *ubuntu* image, you can select *busybox*, a bare
  14. minimal Linux system. The images are retrieved from the Docker
  15. repository.
  16. .. code-block:: bash
  17. #run a simple echo command, that will echo hello world back to the console over standard out.
  18. sudo docker run ubuntu /bin/echo hello world
  19. **Explanation:**
  20. - **"sudo"** execute the following commands as user *root*
  21. - **"docker run"** run a command in a new container
  22. - **"ubuntu"** is the image we want to run the command inside of.
  23. - **"/bin/echo"** is the command we want to run in the container
  24. - **"hello world"** is the input for the echo command
  25. **Video:**
  26. See the example in action
  27. .. raw:: html
  28. <div style="margin-top:10px;">
  29. <iframe width="560" height="350" src="http://ascii.io/a/2603/raw" frameborder="0"></iframe>
  30. </div>
  31. Continue to the :ref:`hello_world_daemon` example.