1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/docs/userguide/level2.md
Mary Anthony 328dbd0aa2 Fixing seds, deleting old stuff
Signed-off-by: Mary Anthony <mary@docker.com>

Upding sed, adding script to avoid redirects, remove mkdos

Signed-off-by: Mary Anthony <mary@docker.com>

Ignoring graphics with sed

Signed-off-by: Mary Anthony <mary@docker.com>

Fixing kitematic image

Signed-off-by: Mary Anthony <mary@docker.com>

Removing draft

Signed-off-by: Mary Anthony <mary@docker.com>

Fixing link

Signed-off-by: Mary Anthony <mary@docker.com>

removing from the menu

Signed-off-by: Mary Anthony <mary@docker.com>

Updatiing order of project material

Signed-off-by: Mary Anthony <mary@docker.com>

Removing from Regsitry v2 content per Olivier

Signed-off-by: Mary Anthony <mary@docker.com>

tweaking the touchup

Signed-off-by: Mary Anthony <mary@docker.com>

Removing include; only used four places; hugo global var replace

Signed-off-by: Mary Anthony <mary@docker.com>

Entering fixes from page-by-page

Signed-off-by: Mary Anthony <mary@docker.com>
2015-06-17 21:05:37 -07:00

6.4 KiB

Back

#Dockerfile tutorial

Test your Dockerfile knowledge - Level 2

Questions:

What is the Dockerfile instruction to specify the base image?
The right answer was FROM

Which Dockerfile instruction sets the default command for your image?
The right answer was ENTRYPOINT or CMD

What is the character used to add comments in Dockerfiles?
The right answer was #

Which Dockerfile instruction sets the username to use when running the image?
The right answer was USER

What is the Dockerfile instruction to execute any command on the current image and commit the results?
The right answer was RUN

Which Dockerfile instruction sets ports to be exposed when running the image?
The right answer was EXPOSE

What is the Dockerfile instruction to specify the maintainer of the Dockerfile?
The right answer was MAINTAINER

Which Dockerfile instruction lets you trigger a command as soon as the container starts?
The right answer was ENTRYPOINT or CMD

<div class="alert alert-success" id="all_good" style="display:none;">Congratulations, you made no mistake!<br />
Tell the world <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.docker.io/learn/dockerfile/level1/" data-text="I just successfully answered questions of the #Dockerfile tutorial Level 1. What's your score?" data-via="docker" >Tweet</a><br />
And try the next challenge: <a href="#fill-the-dockerfile">Fill the Dockerfile</a>
</div>
<div class="alert alert-error" id="no_good" style="display:none;">Your Dockerfile skills are not yet perfect, try to take the time to read this tutorial again.</div>
<div class="alert alert-block" id="some_good" style="display:none;">You're almost there! Read carefully the sections corresponding to your errors, and take the test again!</div>
</p>
<button class="btn btn-primary" id="check_level2_questions">Check your answers</button>

Fill the Dockerfile


Your best friend Roberto Hashioka sent you a Dockerfile, but some parts were lost in the ocean. Can you find the missing parts?
# Redis
#
# VERSION       0.42
#
# use the ubuntu base image provided by dotCloud
  ub
MAINT Ro Ha roberto.hashioka@dotcloud.com
# make sure the package repository is up to date echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list apt-get update
# install wget (required for redis installation) apt-get install -y wget
# install make (required for redis installation) apt-get install -y make
# install gcc (required for redis installation) RUN apt-get install -y
# install apache2 wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable && make && make install
# launch redis when starting the image ["redis-server"]
# run as user daemon daemon
# expose port 6379 6379
Congratulations, you successfully restored Roberto's Dockerfile! You are ready to containerize the world!.
Tell the world! Tweet
Wooops, there are one or more errors in the Dockerfile. Try again.

What's next?

Thanks for going through our tutorial! We will be posting Level 3 in the future.

To improve your Dockerfile writing skills even further, visit the Dockerfile best practices page.

Back to the Docs!