Fix base image creation example commands (#1409)

Example commands for creating a base image do not work due to multiple issues.
- 16:04 not a valid tag for ubuntu image
- apt-get install fails without preceeding `apt-get update`
- gcc command fails without `-nostartfiles` flag
- `docker run` without the `--rm` leaves behind containers which is unintuitive, and inconsistent with the build image used above.
This commit is contained in:
Ryan Sanford 2017-02-07 11:52:31 -06:00 committed by Misty Stanley-Jones
parent 9420f4cc89
commit d91cab01bc
1 changed files with 3 additions and 3 deletions

View File

@ -60,11 +60,11 @@ Assuming you built the "hello" executable example [from the Docker GitHub exampl
NOTE: Because Docker for Mac and Docker for Windows use a Linux VM, you must compile this code using a Linux toolchain to end up with a Linux binary. Not to worry, you can quickly pull down a Linux image and a build environment and build within it:
$ docker run --rm -it -v $PWD:/build ubuntu:16.04
container# apt-get install build-essential
container# apt-get update && apt-get install build-essential
container# cd /build
container# gcc -o hello -static hello.c
container# gcc -o hello -static -nostartfiles hello.c
Then you can run it (on Linux, Mac, or Windows) using: `docker run hello`
Then you can run it (on Linux, Mac, or Windows) using: `docker run --rm hello`
This example creates the hello-world image used in the tutorials.
If you want to test it out, you can clone [the image repo](https://github.com/docker-library/hello-world)