github.com/toophy/docker@v1.8.2/docs/userguide/level2.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Docker images test"
     4  description = "How to work with Docker images."
     5  keywords = ["documentation, docs, the docker guide, docker guide, docker, docker platform, virtualization framework, docker.io, Docker images, Docker image, image management, Docker repos, Docker repositories, docker, docker tag, docker tags, Docker Hub,  collaboration"]
     6  +++
     7  <![end-metadata]-->
     8  
     9  <a title="back" class="dockerfile back" href="/userguide/dockerimages/#creating-our-own-images">Back</a>
    10  
    11  #Dockerfile tutorial
    12  
    13  ## Test your Dockerfile knowledge - Level 2
    14  
    15  ### Questions:
    16  
    17  <div class="level_questions">
    18  What is the Dockerfile instruction to specify the base image?<br>
    19  	<input type="text" class="level">
    20  	<div style="display:none;" id="level2_error0" class="alert alert-error level_error">The right answer was <code>FROM</code></div><br>
    21  	Which Dockerfile instruction sets the default command for your image?<br>
    22  	<input type="text" class="level">
    23  	<div style="display:none;" id="level2_error4" class="alert alert-error level_error">The right answer was <code>ENTRYPOINT</code> or <code>CMD</code></div><br>
    24  	What is the character used to add comments in Dockerfiles?<br>
    25  	<input type="text" class="level">
    26  	<div style="display:none;" id="level2_error3" class="alert alert-error level_error">The right answer was <code>#</code></div><br>
    27      Which Dockerfile instruction sets the username to use when running the image?<br>
    28  	<input type="text" class="level">
    29  	<div style="display:none;" id="level2_error5" class="alert alert-error level_error">The right answer was <code>USER</code></div><br>
    30  	What is the Dockerfile instruction to execute any command on the current image and commit the results?<br>
    31  	<input type="text" class="level">
    32  	<div style="display:none;" id="level2_error1" class="alert alert-error level_error">The right answer was <code>RUN</code></div><br>
    33  	Which Dockerfile instruction sets ports to be exposed when running the image?<br>
    34  	<input type="text" class="level">
    35  	<div style="display:none;" id="level2_error6" class="alert alert-error level_error">The right answer was <code>EXPOSE</code></div><br>
    36  	What is the Dockerfile instruction to specify the maintainer of the Dockerfile?<br>
    37  	<input type="text" class="level">
    38  	<div style="display:none;" id="level2_error2" class="alert alert-error level_error">The right answer was <code>MAINTAINER</code></div><br>
    39  	Which Dockerfile instruction lets you trigger a command as soon as the container starts?<br>
    40  	<input type="text" class="level">
    41  	<div style="display:none;" id="level2_error7" class="alert alert-error level_error">The right answer was <code>ENTRYPOINT</code> or <code>CMD</code></div><br>
    42  	<p>
    43  	
    44  	<div class="alert alert-success" id="all_good" style="display:none;">Congratulations, you made no mistake!<br />
    45  	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 />
    46  	And try the next challenge: <a href="#fill-the-dockerfile">Fill the Dockerfile</a>
    47  	</div>
    48  	<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>
    49  	<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>
    50  	</p>
    51  	<button class="btn btn-primary" id="check_level2_questions">Check your answers</button>
    52  </div>
    53  
    54  ### Fill the Dockerfile
    55  <br>
    56  Your best friend Roberto Hashioka sent you a Dockerfile, but some parts were lost in the ocean. Can you find the missing parts?
    57  <div class="form-inline">
    58  <pre>
    59  &#35; Redis
    60  &#35;
    61  &#35; VERSION       0.42
    62  &#35;
    63  &#35; use the ubuntu base image provided by dotCloud
    64  <input id="from" class="l_fill" type="text">  ub<input id="ubuntu" class="l_fill" type="text"><br>
    65  MAINT<input id="maintainer" class="l_fill" type="text"> Ro<input id="roberto" class="l_fill" type="text"> Ha<input id="hashioka" class="l_fill" type="text"> roberto.hashioka@dotcloud.com<br>
    66  &#35; make sure the package repository is up to date
    67  <input id="run0" class="l_fill" type="text"> echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
    68  <input id="run1" class="l_fill" type="text"> apt-get update<br>
    69  &#35; install wget (required for redis installation)
    70  <input id="run2" class="l_fill" type="text"> apt-get install -y wget<br>
    71  &#35; install make (required for redis installation)
    72  <input id="run3" class="l_fill" type="text"> apt-get install -y make<br>
    73  &#35; install gcc (required for redis installation)
    74  RUN apt-get install -y <input id="gcc" class="l_fill" type="text"><br>
    75  &#35; install apache2
    76  <input id="run4" class="l_fill" type="text"> wget http://download.redis.io/redis-stable.tar.gz
    77  <input id="run5" class="l_fill" type="text">tar xvzf redis-stable.tar.gz
    78  <input id="run6" class="l_fill" type="text">cd redis-stable && make && make install<br>
    79  &#35; launch redis when starting the image
    80  <input id="entrypoint" class="l_fill" type="text"> ["redis-server"]<br>
    81  &#35; run as user daemon
    82  <input id="user" class="l_fill" type="text"> daemon<br>
    83  &#35; expose port 6379
    84  <input id="expose" class="l_fill" type="text"> 6379
    85  </pre>
    86  <div class="alert alert-success" id="dockerfile_ok" style="display:none;">Congratulations, you successfully restored Roberto's Dockerfile! You are ready to containerize the world!.<br />
    87      Tell the world! <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.docker.io/learn/dockerfile/level2/" data-text="I just successfully completed the 'Dockerfill' challenge of the #Dockerfile tutorial Level 2" data-via="docker" >Tweet</a>
    88  </div>
    89  <div class="alert alert-error" id="dockerfile_ko" style="display:none;">Wooops, there are one or more errors in the Dockerfile. Try again.</div>
    90  <br>
    91  <button class="btn btn-primary" id="check_level2_fill">Check the Dockerfile</button></p>
    92  </div>
    93      
    94  ## What's next?
    95  <p>
    96  Thanks for going through our tutorial! We will be posting Level 3 in the future. 
    97  
    98  To improve your Dockerfile writing skills even further, visit the <a href="https://docs.docker.com/articles/dockerfile_best-practices/">Dockerfile best practices page</a>.
    99  
   100  <a title="creating our own images" class="btn btn-primary" href="/userguide/dockerimages/#creating-our-own-images">Back to the Docs!</a>