mirror of
https://github.com/docker/docs.git
synced 2026-04-05 10:48:55 +07:00
1096 lines
50 KiB
XML
1096 lines
50 KiB
XML
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
|
<channel>
|
|
<title>Macs on Docker Docs</title>
|
|
<link>http://localhost/mac/</link>
|
|
<description>Recent content in Macs on Docker Docs</description>
|
|
<generator>Hugo -- gohugo.io</generator>
|
|
<language>en-us</language>
|
|
<atom:link href="http://localhost/mac/index.xml" rel="self" type="application/rss+xml" />
|
|
|
|
<item>
|
|
<title>Build your own image</title>
|
|
<link>http://localhost/mac/step_four/</link>
|
|
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
|
|
|
<guid>http://localhost/mac/step_four/</guid>
|
|
<description>
|
|
|
|
<h1 id="build-your-own-image">Build your own image</h1>
|
|
|
|
<p>The <code>whalesay</code> image could be improved. It would be nice if you didn&rsquo;t have to
|
|
think of something to say. And you type a lot to get <code>whalesay</code> to talk.</p>
|
|
|
|
<pre><code>docker run docker/whalesay cowsay boo-boo
|
|
</code></pre>
|
|
|
|
<p>In this next section, you will improve the <code>whalesay</code> image by building a new version that &ldquo;talks on its own&rdquo; and requires fewer words to run.</p>
|
|
|
|
<h2 id="step-1-write-a-dockerfile">Step 1: Write a Dockerfile</h2>
|
|
|
|
<p>In this step, you use the Mac TextEdit program to write a short Dockerfile. A
|
|
Dockerfile describes the software that is &ldquo;baked&rdquo; into an image. It isn&rsquo;t just
|
|
ingredients tho, it can tell the software what environment to use or what
|
|
commands to run. Your recipe is going to be very short.</p>
|
|
|
|
<p>If you don&rsquo;t already have a terminal open, open one now:</p>
|
|
|
|
<ol>
|
|
<li><p>Open the <strong>Launchpad</strong> and locate the Docker Quickstart Terminal icon.</p>
|
|
|
|
<p><img src="../mac/images/applications_folder.png" alt="Launchpad" /></p></li>
|
|
|
|
<li><p>Click the icon to launch a Docker Quickstart Terminal.</p></li>
|
|
|
|
<li><p>Place your cursor at the prompt in the Docker Quickstart Terminal.</p></li>
|
|
|
|
<li><p>Make a new directory by typing <code>mkdir mydockerbuild</code> and pressing RETURN.</p>
|
|
|
|
<pre><code>$ mkdir mydockerbuild
|
|
</code></pre>
|
|
|
|
<p>This directory serves as the &ldquo;context&rdquo; for your build. The context just means it contains all the things you need to build your image.</p></li>
|
|
|
|
<li><p>Change to your new directory.</p>
|
|
|
|
<pre><code>$ cd mydockerbuild
|
|
</code></pre>
|
|
|
|
<p>Right now the directory is empty.</p></li>
|
|
|
|
<li><p>Create a Dockerfile in the directory by typing <code>touch Dockerfile</code> and pressing RETURN.</p>
|
|
|
|
<pre><code>$ touch Dockerfile
|
|
</code></pre>
|
|
|
|
<p>The command appears to do nothing but it actually creates the Dockerfile in the current directory. Just type <code>ls Dockerfile</code> to see it.</p>
|
|
|
|
<pre><code>$ ls Dockerfile
|
|
Dockerfile
|
|
</code></pre></li>
|
|
|
|
<li><p>Now, type the <code>open -e Dockerfile</code> to open the file in Mac&rsquo;s TextEdit program.</p>
|
|
|
|
<p>Your Mac opens the TextEdit program with the empty Dockerfile.</p>
|
|
|
|
<p><img src="../mac/images/text_edit.png" alt="Edit Dockerfile" /></p></li>
|
|
|
|
<li><p>Type <code>FROM docker/whalesay:latest</code> line into the open file.</p>
|
|
|
|
<p>Now, it should look like this.</p>
|
|
|
|
<p><img src="../mac/images/line_one.png" alt="Line one" /></p>
|
|
|
|
<p>The <code>FROM</code> keyword tells Docker which image your image is based on. You
|
|
are basing your new work on the existing <code>whalesay</code> image.</p></li>
|
|
|
|
<li><p>Now, add the <code>fortunes</code> program to the image.</p>
|
|
|
|
<p><img src="../mac/images/line_two.png" alt="Line two" /></p>
|
|
|
|
<p>The <code>fortunes</code> program has a command that prints out wise sayings for our
|
|
whale to say. So, the first step is to install it. This line adds the
|
|
<code>fortune</code> program using the <code>apt-get</code> program. If these sound all very
|
|
cryptic to you, don&rsquo;t worry. As long as you type the words correctly, they
|
|
will work for you!</p></li>
|
|
|
|
<li><p>Once the image has the software it needs, you instruct the software to run
|
|
when the image is loaded.</p>
|
|
|
|
<p><img src="../mac/images/line_three.png" alt="Line two" /></p>
|
|
|
|
<p>This line tells the <code>fortune</code> program to send its nifty quotes to the <code>cowsay</code> program.</p></li>
|
|
|
|
<li><p>Save your work and the Dockerfile by choosing <strong>File &gt; Save</strong> from the TextEdit menu or by pressing CMD + S on your keyboard.</p>
|
|
|
|
<p>At this point, you have all your software ingredients and behaviors described
|
|
in a Dockerfile. You are ready to build a new image.</p></li>
|
|
</ol>
|
|
|
|
<h2 id="step-2-build-an-image-from-your-dockerfile">Step 2: Build an image from your Dockerfile</h2>
|
|
|
|
<ol>
|
|
<li><p>Place your cursor back in your Docker Quickstart Terminal.</p></li>
|
|
|
|
<li><p>Make sure the Dockerfile is in the current directory by typing <code>cat Dockerfile</code></p>
|
|
|
|
<pre><code>$ cat Dockerfile
|
|
FROM docker/whalesay:latest
|
|
|
|
|
|
RUN apt-get -y update &amp;&amp; apt-get install -y fortunes
|
|
|
|
|
|
CMD /usr/games/fortune -a | cowsay
|
|
</code></pre></li>
|
|
|
|
<li><p>Now, build your new image by typing the <code>docker build -t docker-whale .</code> command in your terminal (don&rsquo;t forget the . period).</p>
|
|
|
|
<pre><code>$ docker build -t docker-whale .
|
|
Sending build context to Docker daemon 158.8 MB
|
|
...snip...
|
|
Removing intermediate container a8e6faa88df3
|
|
Successfully built 7d9495d03763
|
|
</code></pre>
|
|
|
|
<p>The command takes several seconds to run and reports its outcome. Before
|
|
you do anything with the new image, take a minute to learn about the
|
|
Dockerfile build process.</p></li>
|
|
</ol>
|
|
|
|
<h2 id="step-3-learn-about-the-build-process">Step 3: Learn about the build process</h2>
|
|
|
|
<p>The <code>docker build -t docker-whale .</code> command takes the <code>Dockerfile</code> in the
|
|
current directory, and builds an image called <code>docker-whale</code> on your local
|
|
machine. The command takes about a minute and its output looks really long and
|
|
complex. In this section, you learn what each message means.</p>
|
|
|
|
<p>First Docker checks to make sure it has everything it needs to build.</p>
|
|
|
|
<pre><code>Sending build context to Docker daemon 158.8 MB
|
|
</code></pre>
|
|
|
|
<p>Then, Docker loads with the <code>whalesay</code> image. It already has this image
|
|
locally as your might recall from the last page. So, Docker doesn&rsquo;t need to
|
|
download it.</p>
|
|
|
|
<pre><code>Step 0 : FROM docker/whalesay:latest
|
|
---&gt; fb434121fc77
|
|
</code></pre>
|
|
|
|
<p>Docker moves onto the next step which is to update the <code>apt-get</code> package
|
|
manager. This takes a lot of lines, no need to list them all again here.</p>
|
|
|
|
<pre><code>Step 1 : RUN apt-get -y update &amp;&amp; apt-get install -y fortunes
|
|
---&gt; Running in 27d224dfa5b2
|
|
Ign http://archive.ubuntu.com trusty InRelease
|
|
Ign http://archive.ubuntu.com trusty-updates InRelease
|
|
Ign http://archive.ubuntu.com trusty-security InRelease
|
|
Hit http://archive.ubuntu.com trusty Release.gpg
|
|
....snip...
|
|
Get:15 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [14.8 kB]
|
|
Get:16 http://archive.ubuntu.com trusty-security/universe amd64 Packages [134 kB]
|
|
Reading package lists...
|
|
---&gt; eb06e47a01d2
|
|
</code></pre>
|
|
|
|
<p>Then, Docker installs the new <code>fortunes</code> software.</p>
|
|
|
|
<pre><code>Removing intermediate container e2a84b5f390f
|
|
Step 2 : RUN apt-get install -y fortunes
|
|
---&gt; Running in 23aa52c1897c
|
|
Reading package lists...
|
|
Building dependency tree...
|
|
Reading state information...
|
|
The following extra packages will be installed:
|
|
fortune-mod fortunes-min librecode0
|
|
Suggested packages:
|
|
x11-utils bsdmainutils
|
|
The following NEW packages will be installed:
|
|
fortune-mod fortunes fortunes-min librecode0
|
|
0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded.
|
|
Need to get 1961 kB of archives.
|
|
After this operation, 4817 kB of additional disk space will be used.
|
|
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main librecode0 amd64 3.6-21 [771 kB]
|
|
...snip......
|
|
Setting up fortunes (1:1.99.1-7) ...
|
|
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
|
|
---&gt; c81071adeeb5
|
|
Removing intermediate container 23aa52c1897c
|
|
</code></pre>
|
|
|
|
<p>Finally, Docker finishes the build and reports its outcome.</p>
|
|
|
|
<pre><code>Step 3 : CMD /usr/games/fortune -a | cowsay
|
|
---&gt; Running in a8e6faa88df3
|
|
---&gt; 7d9495d03763
|
|
Removing intermediate container a8e6faa88df3
|
|
Successfully built 7d9495d03763
|
|
</code></pre>
|
|
|
|
<h2 id="step-4-run-your-new-docker-whale">Step 4: Run your new docker-whale</h2>
|
|
|
|
<p>In this step, you verify the new images is on your computer and then you run your new image.</p>
|
|
|
|
<ol>
|
|
<li><p>If it isn&rsquo;t already there, place your cursor at the prompt in the Docker Quickstart Terminal window.</p></li>
|
|
|
|
<li><p>Type <code>docker images</code> and press RETURN.</p>
|
|
|
|
<p>This command, you might remember, lists the images you have locally.</p>
|
|
|
|
<pre><code>$ docker images
|
|
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
|
|
docker-whale latest 7d9495d03763 4 minutes ago 273.7 MB
|
|
docker/whalesay latest fb434121fc77 4 hours ago 247 MB
|
|
hello-world latest 91c95931e552 5 weeks ago 910 B
|
|
</code></pre></li>
|
|
|
|
<li><p>Run your new image by typing <code>docker run docker-whale</code> and pressing RETURN.</p>
|
|
|
|
<pre><code>$ docker run docker-whale
|
|
_________________________________________
|
|
/ &quot;He was a modest, good-humored boy. It \
|
|
\ was Oxford that made him insufferable.&quot; /
|
|
-----------------------------------------
|
|
\
|
|
\
|
|
\
|
|
## .
|
|
## ## ## ==
|
|
## ## ## ## ===
|
|
/&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;___/ ===
|
|
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
|
|
\______ o __/
|
|
\ \ __/
|
|
\____\______/
|
|
</code></pre></li>
|
|
</ol>
|
|
|
|
<p>As you can see, you&rsquo;ve made the whale a lot smarter. It finds its own
|
|
things to say and the command line is a lot shorter! You may also notice
|
|
that Docker didn&rsquo;t have to download anything. That is because the image was
|
|
built locally and is already available.</p>
|
|
|
|
<h2 id="where-to-go-next">Where to go next</h2>
|
|
|
|
<p>On this page, you learned to build an image by writing your own Dockerfile.
|
|
You ran your image in a container. You also just used Linux from your Mac yet
|
|
again. In the next section, you take the first step in sharing your image by
|
|
<a href="../mac/step_five/">creating a Docker Hub account</a>.</p>
|
|
|
|
<p>&nbsp;</p>
|
|
</description>
|
|
</item>
|
|
|
|
<item>
|
|
<title>Create a Docker Hub account & repository </title>
|
|
<link>http://localhost/mac/step_five/</link>
|
|
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
|
|
|
<guid>http://localhost/mac/step_five/</guid>
|
|
<description>
|
|
|
|
<h1 id="create-a-docker-hub-account-repository">Create a Docker Hub account &amp; repository</h1>
|
|
|
|
<p>You&rsquo;ve built something really cool, you should share it. In this next section,
|
|
you&rsquo;ll do just that. You&rsquo;ll need a Docker Hub account. Then, you&rsquo;ll push your
|
|
image up to it so other people with Docker can run it.</p>
|
|
|
|
<h2 id="step-1-sign-up-for-an-account">Step 1: Sign up for an account</h2>
|
|
|
|
<ol>
|
|
<li><p>Use your browser to navigate to <a href="https://hub.docker.com/?utm_source=getting_started_guide&utm_medium=embedded_MacOSX&utm_campaign=create_docker_hub_account" target="_blank">the Docker Hub signup page</a>.</p>
|
|
|
|
<p>Your browser displays the page.</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../tutimg/hub_signup.png" />
|
|
|
|
|
|
</figure>
|
|
</li>
|
|
|
|
<li><p>Fill out the form on the signup page.</p>
|
|
|
|
<p>Docker Hub is free. Docker does need a name, password, and email address.</p></li>
|
|
|
|
<li><p>Press <strong>Signup</strong>.</p>
|
|
|
|
<p>The browser displays the welcome to Docker Hub page.</p></li>
|
|
</ol>
|
|
|
|
<h2 id="step-2-verify-your-email-and-add-a-repository">Step 2: Verify your email and add a repository</h2>
|
|
|
|
<p>Before you can share anything on the hub, you need to verify your email address.</p>
|
|
|
|
<ol>
|
|
<li><p>Open your email inbox.</p></li>
|
|
|
|
<li><p>Look for the email titled <code>Please confirm email for your Docker Hub account</code>.</p>
|
|
|
|
<p>If you don&rsquo;t see the email, check your Spam folder or wait a moment for the email to arrive.</p></li>
|
|
|
|
<li><p>Open the email and click the <strong>Confirm Your Email</strong> button.</p>
|
|
|
|
<p>The browser opens Docker Hub to your profile page.</p></li>
|
|
|
|
<li><p>Choose <strong>Create Repository</strong>.</p>
|
|
|
|
<p>The browser opens the <strong>Create Repository</strong> page.</p></li>
|
|
|
|
<li><p>Provide a Repository Name and Short Description.</p></li>
|
|
|
|
<li><p>Make sure Visibility is set to <strong>Public</strong>.</p>
|
|
|
|
<p>When you are done, your form should look similar to the following:</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../tutimg/add_repository.png" />
|
|
|
|
|
|
</figure>
|
|
</li>
|
|
|
|
<li><p>Press <strong>Create</strong> when you are done.</p>
|
|
|
|
<p>Docker Hub creates your new repository.</p></li>
|
|
</ol>
|
|
|
|
<h2 id="where-to-go-next">Where to go next</h2>
|
|
|
|
<p>On this page, you opened an account on Docker Hub and created a new repository.
|
|
In the next section, you populate the repository <a href="../mac/step_six/">by tagging and pushing the
|
|
image you created earlier</a>.</p>
|
|
|
|
<p>&nbsp;</p>
|
|
</description>
|
|
</item>
|
|
|
|
<item>
|
|
<title>Find & run the whalesay image </title>
|
|
<link>http://localhost/mac/step_three/</link>
|
|
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
|
|
|
<guid>http://localhost/mac/step_three/</guid>
|
|
<description>
|
|
|
|
<h1 id="find-and-run-the-whalesay-image">Find and run the whalesay image</h1>
|
|
|
|
<p>People all over the world create Docker images. You can find these images by
|
|
browsing the Docker Hub. In this next section, you&rsquo;ll search for and find the
|
|
image you&rsquo;ll use in the rest of this getting started.</p>
|
|
|
|
<h2 id="step-1-locate-the-whalesay-image">Step 1: Locate the whalesay image</h2>
|
|
|
|
<ol>
|
|
<li><p>Open your browser and <a href="https://hub.docker.com/?utm_source=getting_started_guide&utm_medium=embedded_MacOSX&utm_campaign=find_whalesay" target=_blank> browse to the Docker Hub</a>.</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../tutimg/browse_and_search.png" />
|
|
|
|
|
|
</figure>
|
|
|
|
|
|
<p>The Docker Hub contains images from individuals like you and official images
|
|
from organizations like RedHat, IBM, Google, and a whole lot more.</p></li>
|
|
|
|
<li><p>Click <strong>Browse &amp; Search</strong>.</p>
|
|
|
|
<p>The browser opens the search page.</p></li>
|
|
|
|
<li><p>Enter the word <code>whalesay</code> in the search bar.</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../tutimg/image_found.png" />
|
|
|
|
|
|
</figure>
|
|
</li>
|
|
|
|
<li><p>Click on the <strong>docker/whalesay</strong> image in the results.</p>
|
|
|
|
<p>The browser displays the repository for the <strong>whalesay</strong> image.</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../tutimg/whale_repo.png" />
|
|
|
|
|
|
</figure>
|
|
|
|
|
|
<p>Each image repository contains information about an image. It should
|
|
include information such as what kind of software the image contains and
|
|
how to use it. You may notice that the <strong>whalesay</strong> image is based on a
|
|
Linux distribution called Ubuntu. In the next step, you run the <strong>whalesay</strong> image on your machine.</p></li>
|
|
</ol>
|
|
|
|
<h2 id="step-2-run-the-whalesay-image">Step 2: Run the whalesay image</h2>
|
|
|
|
<p>If you don&rsquo;t already have the Docker Quickstart Terminal open, open one now:</p>
|
|
|
|
<ol>
|
|
<li><p>Open the <strong>Launchpad</strong> and locate the Docker Quickstart Terminal icon.</p>
|
|
|
|
<p><img src="../mac/images/applications_folder.png" alt="Launchpad" /></p></li>
|
|
|
|
<li><p>Click the icon to launch a Docker Quickstart Terminal.</p></li>
|
|
|
|
<li><p>Put your cursor in your Docker Quickstart Terminal at the <code>$</code> prompt.</p></li>
|
|
|
|
<li><p>Type the <code>docker run docker/whalesay cowsay boo</code> command and press RETURN.</p>
|
|
|
|
<p>This command runs the <strong>whalesay</strong> image in a container. Your terminal should look like the following:</p>
|
|
|
|
<pre><code>$ docker run docker/whalesay cowsay boo
|
|
Unable to find image 'docker/whalesay:latest' locally
|
|
latest: Pulling from docker/whalesay
|
|
e9e06b06e14c: Pull complete
|
|
a82efea989f9: Pull complete
|
|
37bea4ee0c81: Pull complete
|
|
07f8e8c5e660: Pull complete
|
|
676c4a1897e6: Pull complete
|
|
5b74edbcaa5b: Pull complete
|
|
1722f41ddcb5: Pull complete
|
|
99da72cfe067: Pull complete
|
|
5d5bd9951e26: Pull complete
|
|
fb434121fc77: Already exists
|
|
Digest: sha256:d6ee73f978a366cf97974115abe9c4099ed59c6f75c23d03c64446bb9cd49163
|
|
Status: Downloaded newer image for docker/whalesay:latest
|
|
_____
|
|
&lt; boo &gt;
|
|
-----
|
|
\
|
|
\
|
|
\
|
|
## .
|
|
## ## ## ==
|
|
## ## ## ## ===
|
|
/&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;___/ ===
|
|
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
|
|
\______ o __/
|
|
\ \ __/
|
|
\____\______/
|
|
</code></pre>
|
|
|
|
<p>The first time you run a software image, the <code>docker</code> command looks for it
|
|
on your local system. If the image isn&rsquo;t there, then <code>docker</code> gets it from
|
|
the hub.</p></li>
|
|
|
|
<li><p>While still in the Docker Quickstart Terminal, type <code>docker images</code> command and press RETURN.</p>
|
|
|
|
<p>The command lists all the images on your local system. You should see
|
|
<code>docker/whalesay</code> in the list.</p>
|
|
|
|
<pre><code>$ docker images
|
|
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
|
|
docker/whalesay latest fb434121fc77 3 hours ago 247 MB
|
|
hello-world latest 91c95931e552 5 weeks ago 910 B
|
|
</code></pre>
|
|
|
|
<p>When you run an image in a container, Docker downloads the image to your
|
|
computer. This local copy of the image saves you time. Docker only
|
|
downloads the image again if the image&rsquo;s source changes on the hub. You
|
|
can, of course, delete the image yourself. You&rsquo;ll learn more about that
|
|
later. Let&rsquo;s leave the image there for now because we are going to use it
|
|
later.</p></li>
|
|
|
|
<li><p>Take a moment to play with the <strong>whalesay</strong> container a bit.</p>
|
|
|
|
<p>Try running the <code>whalesay</code> image again with a word or phrase. Try a long or
|
|
short phrase. Can you break the cow?</p>
|
|
|
|
<pre><code>$ docker run docker/whalesay cowsay boo-boo
|
|
_________
|
|
&lt; boo-boo &gt;
|
|
---------
|
|
\
|
|
\
|
|
\
|
|
## .
|
|
## ## ## ==
|
|
## ## ## ## ===
|
|
/&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;___/ ===
|
|
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
|
|
\______ o __/
|
|
\ \ __/
|
|
\____\______/
|
|
</code></pre></li>
|
|
</ol>
|
|
|
|
<h2 id="where-to-go-next">Where to go next</h2>
|
|
|
|
<p>On this page, you learned to search for images on Docker Hub. You used your
|
|
command line to run an image. Think about it, effectively you ran a piece of
|
|
Linux software on your Mac computer. You learned that running an image copies
|
|
it on your computer. Now, you are ready to create your own image with Docker.
|
|
Go on to the next part <a href="../mac/step_four/">to build your own image</a>.</p>
|
|
|
|
<p>&nbsp;</p>
|
|
</description>
|
|
</item>
|
|
|
|
<item>
|
|
<title>Get Started with Docker</title>
|
|
<link>http://localhost/mac/started/</link>
|
|
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
|
|
|
<guid>http://localhost/mac/started/</guid>
|
|
<description>
|
|
|
|
<h1 id="get-started-with-docker-for-mac-os-x">Get Started with Docker for Mac OS X</h1>
|
|
|
|
<h4 id="this-is-written-for-users-of-mac-os-x-if-you-are-not-using-mac-os-x-see-the-linux-linux-started-md-or-windows-windows-started-md-version"><strong>This is written for users of Mac OS X. If you are not using Mac OS X, see the <a href="../linux/started/">Linux</a> or <a href="../windows/started/">Windows</a> version.</strong></h4>
|
|
|
|
<p>This getting started is for non-technical users who are interested in learning about Docker. By following this getting started, you&rsquo;ll learn fundamental Docker features by performing some simple tasks. You&rsquo;ll learn how to:</p>
|
|
|
|
<ul>
|
|
<li>install Docker</li>
|
|
<li>run a software image in a container</li>
|
|
<li>browse for an image on Docker Hub</li>
|
|
<li>create your own image and run it in a container</li>
|
|
<li>create a Docker Hub account and an image repository</li>
|
|
<li>create an image of your own</li>
|
|
<li>push your image to Docker Hub for others to use</li>
|
|
</ul>
|
|
|
|
<p>The getting started was user tested to reduce the chance of users having problems. For the best chance of success, follow the steps as written the first time before exploring on your own. It takes approximately 45 minutes to complete.</p>
|
|
|
|
<h3 id="make-sure-you-understand">Make sure you understand&hellip;</h3>
|
|
|
|
<p>This getting started uses Docker commands with a terminal window. You don&rsquo;t need
|
|
to be experienced using a command line, but you should be familiar with how to
|
|
open one and type commands.</p>
|
|
|
|
<p>Go to <a href="../mac/step_one/">the next page to install</a>.</p>
|
|
|
|
<p>&nbsp;</p>
|
|
</description>
|
|
</item>
|
|
|
|
<item>
|
|
<title>Install Docker on OS X</title>
|
|
<link>http://localhost/mac/step_one/</link>
|
|
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
|
|
|
<guid>http://localhost/mac/step_one/</guid>
|
|
<description>
|
|
|
|
<h1 id="install-docker-mac-os-x">Install Docker Mac OS X</h1>
|
|
|
|
<p>You install Docker using Docker Toolbox. Docker Toolbox includes the following Docker tools:</p>
|
|
|
|
<ul>
|
|
<li>Docker Machine for running the <code>docker-machine</code> binary</li>
|
|
<li>Docker Engine for running the <code>docker</code> binary</li>
|
|
<li>Docker Compose for running the <code>docker-compose</code> binary</li>
|
|
<li>Kitematic, the Docker GUI</li>
|
|
<li>a shell preconfigured for a Docker command-line environment</li>
|
|
<li>Oracle VM VirtualBox</li>
|
|
</ul>
|
|
|
|
<p>Because the Docker daemon uses Linux-specific kernel features, you can&rsquo;t run
|
|
Docker natively in OS X. Instead, you must use <code>docker-machine</code> to create and
|
|
attach to a Docker VM on your machine. This VM hosts Docker for you on your Mac.</p>
|
|
|
|
<h2 id="step-1-check-your-version">Step 1: Check your version</h2>
|
|
|
|
<p>Your Mac must be running OS X 10.8 &ldquo;Mountain Lion&rdquo; or newer to run Docker.
|
|
To find out what version of the OS you have:</p>
|
|
|
|
<ol>
|
|
<li><p>Choose <strong>About this Mac</strong> from the Apple menu.</p>
|
|
|
|
<p><img src="../mac/images/which_version.png" alt="Which version" /></p>
|
|
|
|
<p>The version number appears directly below the words <code>OS X</code>.</p></li>
|
|
|
|
<li><p>If you have the correct version, go to the next step.</p>
|
|
|
|
<p>If you aren&rsquo;t using a supported version, you could consider upgrading your
|
|
operating system.</p></li>
|
|
</ol>
|
|
|
|
<h2 id="step-2-install-docker-toolbox">Step 2: Install Docker Toolbox</h2>
|
|
|
|
<ol>
|
|
<li><p>Go to the <a href="https://www.docker.com/toolbox" targe="_blank">Docker Toolbox</a>.</p></li>
|
|
|
|
<li><p>Click the installer link to download.</p></li>
|
|
|
|
<li><p>Install Docker Toolbox by double-clicking the package or by right-clicking
|
|
and choosing &ldquo;Open&rdquo; from the pop-up menu.</p>
|
|
|
|
<p>The installer launches an introductory dialog, followed by an overview of what&rsquo;s installed.</p>
|
|
|
|
<p><img src="../mac/images/mac-welcome-page.png" alt="Install Docker Toolbox" /></p></li>
|
|
|
|
<li><p>Press <strong>Continue</strong> to install the toolbox.</p>
|
|
|
|
<p>The installer presents you with options to customize the standard
|
|
installation.</p>
|
|
|
|
<p><img src="../mac/images/mac-page-two.png" alt="Standard install" /></p>
|
|
|
|
<p>By default, the standard Docker Toolbox installation:</p>
|
|
|
|
<ul>
|
|
<li>installs binaries for the Docker tools in <code>/usr/local/bin</code></li>
|
|
<li>makes these binaries available to all users</li>
|
|
<li>updates any existing Virtual Box installation</li>
|
|
</ul>
|
|
|
|
<p>For now, don&rsquo;t change any of the defaults.</p></li>
|
|
|
|
<li><p>Press <strong>Install</strong> to perform the standard installation.</p>
|
|
|
|
<p>The system prompts you for your password.</p>
|
|
|
|
<p><img src="../mac/images/mac-password-prompt.png" alt="Password prompt" /></p></li>
|
|
|
|
<li><p>Provide your password to continue with the installation.</p>
|
|
|
|
<p>When it completes, the installer provides you with some shortcuts. You can ignore this for now and click <strong>Continue</strong>.</p>
|
|
|
|
<p><img src="../mac/images/mac-page-quickstart.png" alt="Quickstart" /></p>
|
|
|
|
<p>Then click <strong>Close</strong> to finish the installer.</p>
|
|
|
|
<p><img src="../mac/images/mac-page-finished.png" alt="All finished" /></p></li>
|
|
</ol>
|
|
|
|
<h2 id="step-3-verify-your-installation">Step 3: Verify your installation</h2>
|
|
|
|
<p>To run a Docker container, you:</p>
|
|
|
|
<ul>
|
|
<li>create a new (or start an existing) Docker virtual machine</li>
|
|
<li>switch your environment to your new VM</li>
|
|
<li>use the <code>docker</code> client to create, load, and manage containers</li>
|
|
</ul>
|
|
|
|
<p>Once you create a machine, you can reuse it as often as you like. Like any
|
|
Virtual Box VM, it maintains its configuration between uses.</p>
|
|
|
|
<ol>
|
|
<li><p>Open the <strong>Launchpad</strong> and locate the Docker Quickstart Terminal icon.</p>
|
|
|
|
<p><img src="../mac/images/applications_folder.png" alt="Launchpad" /></p></li>
|
|
|
|
<li><p>Click the icon to launch a Docker Quickstart Terminal window.</p>
|
|
|
|
<p>The terminal does a number of things to set up Docker Quickstart Terminal for you.</p>
|
|
|
|
<pre><code>Last login: Sat Jul 11 20:09:45 on ttys002
|
|
bash '/Applications/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
|
|
Get http:///var/run/docker.sock/v1.19/images/json?all=1&amp;filters=%7B%22dangling%22%3A%5B%22true%22%5D%7D: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
|
|
Get http:///var/run/docker.sock/v1.19/images/json?all=1: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
|
|
-bash: lolcat: command not found
|
|
|
|
|
|
mary at meepers in ~
|
|
$ bash '/Applications/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh'
|
|
Creating Machine dev...
|
|
Creating VirtualBox VM...
|
|
Creating SSH key...
|
|
Starting VirtualBox VM...
|
|
Starting VM...
|
|
To see how to connect Docker to this machine, run: docker-machine env dev
|
|
Starting machine dev...
|
|
Setting environment variables for machine dev...
|
|
|
|
|
|
## .
|
|
## ## ## ==
|
|
## ## ## ## ## ===
|
|
/&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;\___/ ===
|
|
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
|
|
\______ o __/
|
|
\ \ __/
|
|
\____\_______/
|
|
|
|
|
|
The Docker Quick Start Terminal is configured to use Docker with the “default” VM.
|
|
</code></pre></li>
|
|
|
|
<li><p>Click your mouse in the terminal window to make it active.</p>
|
|
|
|
<p>If you aren&rsquo;t familiar with a terminal window, here are some quick tips.</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../tutimg/terminal.png" />
|
|
|
|
|
|
</figure>
|
|
|
|
|
|
<p>The prompt is traditionally a <code>$</code> dollar sign. You type commands into the
|
|
<em>command line</em> which is the area after the prompt. Your cursor is indicated
|
|
by a highlighted area or a <code>|</code> that appears in the command line. After
|
|
typing a command, always press RETURN.</p></li>
|
|
|
|
<li><p>Type the <code>docker run hello-world</code> command and press RETURN.</p>
|
|
|
|
<p>The command does some work for you, if everything runs well, the command&rsquo;s
|
|
output looks like this:</p>
|
|
|
|
<pre><code>$ docker run hello-world
|
|
</code></pre>
|
|
|
|
<p>Unable to find image &lsquo;hello-world:latest&rsquo; locally
|
|
latest: Pulling from library/hello-world
|
|
535020c3e8ad: Pull complete
|
|
af340544ed62: Pull complete
|
|
Digest: sha256:a68868bfe696c00866942e8f5ca39e3e31b79c1e50feaee4ce5e28df2f051d5c
|
|
Status: Downloaded newer image for hello-world:latest</p>
|
|
|
|
<p>Hello from Docker.
|
|
This message shows that your installation appears to be working correctly.</p>
|
|
|
|
<p>To generate this message, Docker took the following steps:</p>
|
|
|
|
<ol>
|
|
<li>The Docker client contacted the Docker daemon.</li>
|
|
<li>The Docker daemon pulled the &ldquo;hello-world&rdquo; image from the Docker Hub.</li>
|
|
<li>The Docker daemon created a new container from that image which runs the
|
|
executable that produces the output you are currently reading.</li>
|
|
<li>The Docker daemon streamed that output to the Docker client, which sent it
|
|
to your terminal.</li>
|
|
</ol>
|
|
|
|
<p>To try something more ambitious, you can run an Ubuntu container with:
|
|
$ docker run -it ubuntu bash</p>
|
|
|
|
<p>Share images, automate workflows, and more with a free Docker Hub account:
|
|
<a href="https://hub.docker.com">https://hub.docker.com</a></p>
|
|
|
|
<p>For more examples and ideas, visit:
|
|
<a href="https://docs.docker.com/userguide/">https://docs.docker.com/userguide/</a></p>
|
|
|
|
<pre><code>To try something more ambitious, you can run an Ubuntu container with:
|
|
$ docker run -it ubuntu bash
|
|
|
|
|
|
For more examples and ideas, visit:
|
|
https://docs.docker.com/userguide/
|
|
</code></pre></li>
|
|
</ol>
|
|
|
|
<h2 id="where-to-go-next">Where to go next</h2>
|
|
|
|
<p>At this point, you have successfully installed Docker. Leave the Docker Quickstart Terminal
|
|
window open. Now, go to the next page to <a href="../mac/step_two/">read a very short introduction Docker
|
|
images and containers</a>.</p>
|
|
|
|
<p>&nbsp;</p>
|
|
</description>
|
|
</item>
|
|
|
|
<item>
|
|
<title>Learning more</title>
|
|
<link>http://localhost/mac/last_page/</link>
|
|
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
|
|
|
<guid>http://localhost/mac/last_page/</guid>
|
|
<description>
|
|
|
|
<h1 id="learning-more">Learning more</h1>
|
|
|
|
<p>Depending on your interest, the Docker documentation contains a wealth of information. Here are some places that might interest you:</p>
|
|
|
|
<p><style type="text/css">
|
|
</style>
|
|
<table class="tutorial">
|
|
<tr>
|
|
<th class="tg-031e">If you are looking for</th>
|
|
<th class="tg-031e">Where to find it</th>
|
|
</tr>
|
|
<tr>
|
|
<td class="tg-031e">This getting started provided very basic essentials for using Docker on Mac OS X. If you want to do more on your Mac with Docker, start with the full installation and user guide for Docker Toolbox.</td>
|
|
<td class="tg-031e"><a href="https://docs.docker.com/installation/mac/">Install Docker Toolbox</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="tg-031e">Information about the Docker product line.</td>
|
|
<td class="tg-031e"><a href="http://www.docker.com/products">The product explainer is a good place to start.</a></td>
|
|
</tr></p>
|
|
|
|
<p><tr>
|
|
<td class="tg-031e">Set up an automated build on Docker Hub.</td>
|
|
<td class="tg-031e"><a href="https://docs.docker.com/docker-hub/">The Docker Hub documentation.</a></td>
|
|
</tr>
|
|
</table></p>
|
|
|
|
<p>&nbsp;</p>
|
|
</description>
|
|
</item>
|
|
|
|
<item>
|
|
<title>Tag, push, & pull your image</title>
|
|
<link>http://localhost/mac/step_six/</link>
|
|
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
|
|
|
<guid>http://localhost/mac/step_six/</guid>
|
|
<description>
|
|
|
|
<h1 id="tag-push-and-pull-your-image">Tag, push, and pull your image</h1>
|
|
|
|
<p>In this section, you tag and push your <code>docker-whale</code> image to your newly
|
|
created repository. When you are done, you test the repository by pulling your
|
|
new image.</p>
|
|
|
|
<h2 id="step-1-tag-and-push-the-image">Step 1: Tag and push the image</h2>
|
|
|
|
<p>If you don&rsquo;t already have a terminal open, open one now:</p>
|
|
|
|
<ol>
|
|
<li><p>Open the <strong>Launchpad</strong> and locate the Docker Quickstart Terminal icon.</p>
|
|
|
|
<p><img src="../mac/images/applications_folder.png" alt="Launchpad" /></p></li>
|
|
|
|
<li><p>Click the icon to launch a Docker Quickstart Terminal.</p></li>
|
|
|
|
<li><p>Place your cursor at the prompt in the Docker Quickstart Terminal window.</p></li>
|
|
|
|
<li><p>Type <code>docker images</code> to list the images you currently have:</p>
|
|
|
|
<pre><code>$ docker images
|
|
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
|
|
docker-whale latest 7d9495d03763 38 minutes ago 273.7 MB
|
|
&lt;none&gt; &lt;none&gt; 5dac217f722c 45 minutes ago 273.7 MB
|
|
docker/whalesay latest fb434121fc77 4 hours ago 247 MB
|
|
hello-world latest 91c95931e552 5 weeks ago 910 B
|
|
</code></pre></li>
|
|
|
|
<li><p>Find the <code>IMAGE ID</code> for your <code>docker-whale</code> image.</p>
|
|
|
|
<p>In this example, the id is <code>7d9495d03763</code>.</p>
|
|
|
|
<p>You&rsquo;ll notice that currently, the <code>REPOSITORY</code> shows the repository but not
|
|
the namespace for <code>docker-whale</code>. You need to include the <code>namespace</code> for
|
|
Docker Hub to associate it with your account. The <code>namespace</code> is the same as
|
|
your account name.</p></li>
|
|
|
|
<li><p>Use <code>IMAGE ID</code> and the <code>docker tag</code> command to tag your <code>docker-whale</code> image.</p>
|
|
|
|
<p>The command you type looks like this:</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../tutimg/tagger.png" />
|
|
|
|
|
|
</figure>
|
|
|
|
|
|
<p>Of course, your account name will be your own. So, you type the command with
|
|
your image&rsquo;s ID and your account name and press RETURN.</p>
|
|
|
|
<pre><code>$ docker tag 7d9495d03763 maryatdocker/docker-whale:latest
|
|
</code></pre></li>
|
|
|
|
<li><p>Type the <code>docker images</code> command again to see your newly tagged image.</p>
|
|
|
|
<pre><code>$ docker images
|
|
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
|
|
maryatdocker/docker-whale latest 7d9495d03763 5 minutes ago 273.7 MB
|
|
docker-whale latest 7d9495d03763 2 hours ago 273.7 MB
|
|
&lt;none&gt; &lt;none&gt; 5dac217f722c 5 hours ago 273.7 MB
|
|
docker/whalesay latest fb434121fc77 5 hours ago 247 MB
|
|
hello-world latest 91c95931e552 5 weeks ago 910 B
|
|
</code></pre></li>
|
|
|
|
<li><p>Use the <code>docker login</code> command to log into the Docker Hub from the command line.</p>
|
|
|
|
<p>The format for the login command is:</p>
|
|
|
|
<pre><code>docker login --username=yourhubusername --password=yourpassword --email=youremail@company.com
|
|
</code></pre>
|
|
|
|
<p>So, for example:</p>
|
|
|
|
<pre><code>$ docker login --username=maryatdocker --password=uydfiad77fad --email=mary@docker.com
|
|
WARNING: login credentials saved in C:\Users\sven\.docker\config.json
|
|
Login Succeeded
|
|
</code></pre></li>
|
|
|
|
<li><p>Type the <code>docker push</code> command to push your image to your new repository.</p>
|
|
|
|
<pre><code>$ docker push maryatdocker/docker-whale
|
|
The push refers to a repository [maryatdocker/docker-whale] (len: 1)
|
|
7d9495d03763: Image already exists
|
|
c81071adeeb5: Image successfully pushed
|
|
eb06e47a01d2: Image successfully pushed
|
|
fb434121fc77: Image successfully pushed
|
|
5d5bd9951e26: Image successfully pushed
|
|
99da72cfe067: Image successfully pushed
|
|
1722f41ddcb5: Image successfully pushed
|
|
5b74edbcaa5b: Image successfully pushed
|
|
676c4a1897e6: Image successfully pushed
|
|
07f8e8c5e660: Image successfully pushed
|
|
37bea4ee0c81: Image successfully pushed
|
|
a82efea989f9: Image successfully pushed
|
|
e9e06b06e14c: Image successfully pushed
|
|
Digest: sha256:ad89e88beb7dc73bf55d456e2c600e0a39dd6c9500d7cd8d1025626c4b985011
|
|
</code></pre></li>
|
|
|
|
<li><p>Return to your profile on Docker Hub to see your new image.</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../tutimg/new_image.png" />
|
|
|
|
|
|
</figure>
|
|
</li>
|
|
</ol>
|
|
|
|
<h1 id="step-2-pull-your-new-image">Step 2: Pull your new image</h1>
|
|
|
|
<p>In this last section, you&rsquo;ll pull the image you just pushed to hub. Before you
|
|
do that though, you&rsquo;ll need to remove the original image from your local
|
|
machine. If you left the original image on your machine. Docker would not pull
|
|
from the hub &mdash; why would it? The two images are identical.</p>
|
|
|
|
<ol>
|
|
<li><p>Place your cursor at the prompt in the Docker Quickstart Terminal window.</p></li>
|
|
|
|
<li><p>Type <code>docker images</code> to list the images you currently have on your local machine.</p>
|
|
|
|
<pre><code>$ docker images
|
|
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
|
|
maryatdocker/docker-whale latest 7d9495d03763 5 minutes ago 273.7 MB
|
|
docker-whale latest 7d9495d03763 2 hours ago 273.7 MB
|
|
&lt;none&gt; &lt;none&gt; 5dac217f722c 5 hours ago 273.7 MB
|
|
docker/whalesay latest fb434121fc77 5 hours ago 247 MB
|
|
hello-world latest 91c95931e552 5 weeks ago 910 B
|
|
</code></pre>
|
|
|
|
<p>To make a good test, you need to remove the <code>maryatdocker/docker-whale</code> and
|
|
<code>docker-whale</code> images from your local system. Removing them forces the next
|
|
<code>docker pull</code> to get the image from your repository.</p></li>
|
|
|
|
<li><p>Use the <code>docker rmi</code> to remove the <code>maryatdocker/docker-whale</code> and <code>docker-whale</code>
|
|
images.</p>
|
|
|
|
<p>You can use an ID or the name to remove an image.</p>
|
|
|
|
<pre><code>$ docker rmi -f 7d9495d03763
|
|
$ docker rmi -f docker-whale
|
|
</code></pre></li>
|
|
|
|
<li><p>Pull a new image from your repository using the <code>docker pull</code> command.</p>
|
|
|
|
<p>The command you type should include your username from Docker Hub.</p>
|
|
|
|
<pre><code> docker pull yourusername/docker-whale
|
|
</code></pre>
|
|
|
|
<p>Since the image is no longer available on your local system, Docker downloads it.</p>
|
|
|
|
<pre><code>$ docker run maryatdocker/docker-whale
|
|
Unable to find image 'maryatdocker/docker-whale:latest' locally
|
|
latest: Pulling from maryatdocker/docker-whale
|
|
eb06e47a01d2: Pull complete
|
|
c81071adeeb5: Pull complete
|
|
7d9495d03763: Already exists
|
|
e9e06b06e14c: Already exists
|
|
a82efea989f9: Already exists
|
|
37bea4ee0c81: Already exists
|
|
07f8e8c5e660: Already exists
|
|
676c4a1897e6: Already exists
|
|
5b74edbcaa5b: Already exists
|
|
1722f41ddcb5: Already exists
|
|
99da72cfe067: Already exists
|
|
5d5bd9951e26: Already exists
|
|
fb434121fc77: Already exists
|
|
Digest: sha256:ad89e88beb7dc73bf55d456e2c600e0a39dd6c9500d7cd8d1025626c4b985011
|
|
Status: Downloaded newer image for maryatdocker/docker-whale:latest
|
|
________________________________________
|
|
/ Having wandered helplessly into a \
|
|
| blinding snowstorm Sam was greatly |
|
|
| relieved to see a sturdy Saint Bernard |
|
|
| dog bounding toward him with the |
|
|
| traditional keg of brandy strapped to |
|
|
| his collar. |
|
|
| |
|
|
| &quot;At last,&quot; cried Sam, &quot;man's best |
|
|
\ friend -- and a great big dog, too!&quot; /
|
|
----------------------------------------
|
|
\
|
|
\
|
|
\
|
|
## .
|
|
## ## ## ==
|
|
## ## ## ## ===
|
|
/&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;___/ ===
|
|
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
|
|
\______ o __/
|
|
\ \ __/
|
|
\____\______/
|
|
</code></pre></li>
|
|
</ol>
|
|
|
|
<h2 id="where-to-go-next">Where to go next</h2>
|
|
|
|
<p>You&rsquo;ve done a lot, you&rsquo;ve done all of the following fundamental Docker tasks.</p>
|
|
|
|
<ul>
|
|
<li>installed Docker</li>
|
|
<li>run a software image in a container</li>
|
|
<li>located an interesting image on Docker Hub</li>
|
|
<li>run the image on your own machine</li>
|
|
<li>modified an image to create your own and run it</li>
|
|
<li>create a Docker Hub account and repository</li>
|
|
<li>pushed your image to Docker Hub for others to share</li>
|
|
</ul>
|
|
|
|
<p><a href="https://twitter.com/intent/tweet?button_hashtag=dockerdocs&text=Just%20ran%20a%20container%20with%20an%20image%20I%20built.%20Find%20it%20on%20%23dockerhub.%20Build%20your%20own%3A%20http%3A%2F%2Fgoo.gl%2FMUi7cA" class="twitter-hashtag-button" data-size="large" data-related="docker" target="_blank">Tweet your accomplishment!</a>
|
|
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?&lsquo;http&rsquo;:&lsquo;https&rsquo;;if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+&rsquo;://platform.twitter.com/widgets.js&rsquo;;fjs.parentNode.insertBefore(js,fjs);}}(document, &lsquo;script&rsquo;, &lsquo;twitter-wjs&rsquo;);</script></p>
|
|
|
|
<p>You&rsquo;ve only scratched the surface of what Docker can do. Go to the next page to <a href="../mac/last_page/">learn more</a>.</p>
|
|
|
|
<p>&nbsp;</p>
|
|
</description>
|
|
</item>
|
|
|
|
<item>
|
|
<title>Understand images & containers</title>
|
|
<link>http://localhost/mac/step_two/</link>
|
|
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
|
|
|
<guid>http://localhost/mac/step_two/</guid>
|
|
<description>
|
|
|
|
<h1 id="learn-about-images-containers">Learn about images &amp; containers</h1>
|
|
|
|
<p>As the last step in your installation, you ran the <code>docker run hello-world</code> command. With this one command, you completed the core tasks to using Docker. The command you ran had three parts.</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../tutimg/container_explainer.png" />
|
|
|
|
|
|
</figure>
|
|
|
|
|
|
<p>A <em>container</em> is a stripped-to-basics version of a Linux operating system. An <em>image</em> is software you load into a container. When you ran the command, the Docker software:</p>
|
|
|
|
<ul>
|
|
<li>checked to see if you had the <code>hello-world</code> software image</li>
|
|
<li>downloaded the image from the Docker Hub (more about the hub later)</li>
|
|
<li>loaded the image into the container and &ldquo;ran&rdquo; it</li>
|
|
</ul>
|
|
|
|
<p>Depending on how it was built, an image might run a simple, single command and then exit. This is what <code>Hello-World</code> did.</p>
|
|
|
|
<p>A Docker image, though, is capable of much more. An image can start software as complex as a database, wait for you (or someone else) to add data, store the data for later use, and then wait for the next person.</p>
|
|
|
|
<p>Who built the <code>hello-world</code> software image though? In this case, Docker did but anyone can. Docker lets people (or companies) create and share software through Docker images. Using Docker, you don&rsquo;t have to worry about whether your computer can run the software in a Docker image &mdash; a Docker container <em>can always run it</em>.</p>
|
|
|
|
<h2 id="where-to-go-next">Where to go next</h2>
|
|
|
|
<p>See, that was quick wasn&rsquo;t it? Now, you are ready to do some really fun stuff with Docker.
|
|
Go on to the next part <a href="../mac/step_three/">to find and run the whalesay image</a>.</p>
|
|
|
|
<p>&nbsp;</p>
|
|
</description>
|
|
</item>
|
|
|
|
</channel>
|
|
</rss> |