mirror of https://github.com/docker/docs.git
Merge pull request #13376 from docker/master
Publish updates from master
This commit is contained in:
commit
0135b690fc
|
|
@ -1353,7 +1353,7 @@ manuals:
|
||||||
- path: /docker-hub/service-accounts/
|
- path: /docker-hub/service-accounts/
|
||||||
title: Service accounts
|
title: Service accounts
|
||||||
- path: /docker-hub/official_images/
|
- path: /docker-hub/official_images/
|
||||||
title: Official images
|
title: Docker Official images
|
||||||
- sectiontitle: Automated builds
|
- sectiontitle: Automated builds
|
||||||
section:
|
section:
|
||||||
- path: /docker-hub/builds/
|
- path: /docker-hub/builds/
|
||||||
|
|
@ -1399,7 +1399,7 @@ manuals:
|
||||||
- path: /docker-hub/deactivate-account/
|
- path: /docker-hub/deactivate-account/
|
||||||
title: Deactivate an account or an organization
|
title: Deactivate an account or an organization
|
||||||
- path: /docker-hub/publish/
|
- path: /docker-hub/publish/
|
||||||
title: Verified Publisher Program
|
title: Docker Verified Publisher Program
|
||||||
- path: /docker-hub/release-notes/
|
- path: /docker-hub/release-notes/
|
||||||
title: Release notes
|
title: Release notes
|
||||||
- sectiontitle: Docker subscription
|
- sectiontitle: Docker subscription
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
<ul class="footer_links">
|
<ul class="footer_links">
|
||||||
<li><b><a href="https://www.docker.com/products/docker-desktop">Pricing</a></b></li>
|
<li><b><a href="https://www.docker.com/products/docker-desktop">Pricing</a></b></li>
|
||||||
<li><a href="https://www.docker.com/pricing/faq">FAQs</a></li>
|
<li><a href="https://www.docker.com/pricing/faq">FAQs</a></li>
|
||||||
<li><a href="https://www.docker.com/partners/programs">Verified Publisher Program</a></li>
|
<li><a href="https://www.docker.com/partners/programs">Docker Verified Publisher Program</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-3 col-md-3">
|
<div class="col-xs-12 col-sm-3 col-md-3">
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ operating systems, such as Windows.
|
||||||
When running an image with multi-architecture support, `docker` automatically
|
When running an image with multi-architecture support, `docker` automatically
|
||||||
selects the image variant that matches your OS and architecture.
|
selects the image variant that matches your OS and architecture.
|
||||||
|
|
||||||
Most of the official images on Docker Hub provide a [variety of architectures](https://github.com/docker-library/official-images#architectures-other-than-amd64){: target="_blank" rel="noopener" class="_" }.
|
Most of the Docker Official Images on Docker Hub provide a [variety of architectures](https://github.com/docker-library/official-images#architectures-other-than-amd64){: target="_blank" rel="noopener" class="_" }.
|
||||||
For example, the `busybox` image supports `amd64`, `arm32v5`, `arm32v6`,
|
For example, the `busybox` image supports `amd64`, `arm32v5`, `arm32v6`,
|
||||||
`arm32v7`, `arm64v8`, `i386`, `ppc64le`, and `s390x`. When running this image
|
`arm32v7`, `arm64v8`, `i386`, `ppc64le`, and `s390x`. When running this image
|
||||||
on an `x86_64` / `amd64` machine, the `x86_64` variant is pulled and run.
|
on an `x86_64` / `amd64` machine, the `x86_64` variant is pulled and run.
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@ This example creates the hello-world image used in the tutorials.
|
||||||
If you want to test it out, you can clone
|
If you want to test it out, you can clone
|
||||||
[the image repo](https://github.com/docker-library/hello-world).
|
[the image repo](https://github.com/docker-library/hello-world).
|
||||||
|
|
||||||
|
|
||||||
## More resources
|
## More resources
|
||||||
|
|
||||||
There are lots of resources available to help you write your `Dockerfile`.
|
There are lots of resources available to help you write your `Dockerfile`.
|
||||||
|
|
@ -110,4 +109,4 @@ There are lots of resources available to help you write your `Dockerfile`.
|
||||||
* There's a [complete guide to all the instructions](../../engine/reference/builder.md) available for use in a `Dockerfile` in the reference section.
|
* There's a [complete guide to all the instructions](../../engine/reference/builder.md) available for use in a `Dockerfile` in the reference section.
|
||||||
* To help you write a clear, readable, maintainable `Dockerfile`, we've also
|
* To help you write a clear, readable, maintainable `Dockerfile`, we've also
|
||||||
written a [`Dockerfile` best practices guide](dockerfile_best-practices.md).
|
written a [`Dockerfile` best practices guide](dockerfile_best-practices.md).
|
||||||
* If your goal is to create a new Official Image, be sure to read up on Docker's [Official Images](../../docker-hub/official_images.md).
|
* If your goal is to create a new Docker Official Image, read [Docker Official Images](../../docker-hub/official_images.md).
|
||||||
|
|
|
||||||
|
|
@ -908,7 +908,7 @@ fails catastrophically if the new build's context is missing the resource being
|
||||||
added. Adding a separate tag, as recommended above, helps mitigate this by
|
added. Adding a separate tag, as recommended above, helps mitigate this by
|
||||||
allowing the `Dockerfile` author to make a choice.
|
allowing the `Dockerfile` author to make a choice.
|
||||||
|
|
||||||
## Examples for Official Images
|
## Examples of Docker Official Images
|
||||||
|
|
||||||
These Official Images have exemplary `Dockerfile`s:
|
These Official Images have exemplary `Dockerfile`s:
|
||||||
|
|
||||||
|
|
@ -922,6 +922,6 @@ These Official Images have exemplary `Dockerfile`s:
|
||||||
* [Dockerfile Reference](../../engine/reference/builder.md)
|
* [Dockerfile Reference](../../engine/reference/builder.md)
|
||||||
* [More about Base Images](baseimages.md)
|
* [More about Base Images](baseimages.md)
|
||||||
* [More about Automated Builds](../../docker-hub/builds/index.md)
|
* [More about Automated Builds](../../docker-hub/builds/index.md)
|
||||||
* [Guidelines for Creating Official Images](../../docker-hub/official_images.md)
|
* [Guidelines for Creating Docker Official Images](../../docker-hub/official_images.md)
|
||||||
* [Best practices to containerize Node.js web applications with Docker](https://snyk.io/blog/10-best-practices-to-containerize-nodejs-web-applications-with-docker){:target="_blank" rel="noopener" class="_"}
|
* [Best practices to containerize Node.js web applications with Docker](https://snyk.io/blog/10-best-practices-to-containerize-nodejs-web-applications-with-docker){:target="_blank" rel="noopener" class="_"}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,9 @@ Docker Hub provides the following major features:
|
||||||
* [Repositories](repos.md): Push and pull container images.
|
* [Repositories](repos.md): Push and pull container images.
|
||||||
* [Teams & Organizations](orgs.md): Manage access to private
|
* [Teams & Organizations](orgs.md): Manage access to private
|
||||||
repositories of container images.
|
repositories of container images.
|
||||||
* [Official Images](official_images.md): Pull and use high-quality
|
* [Docker Official Images](official_images.md): Pull and use high-quality
|
||||||
container images provided by Docker.
|
container images provided by Docker.
|
||||||
* [Publisher Images](publish/customer_faq.md): Pull and use high-
|
* [Docker Verified Publisher Images](publish/index.md): Pull and use high-
|
||||||
quality container images provided by external vendors.
|
quality container images provided by external vendors.
|
||||||
* [Builds](builds/index.md): Automatically build container images from
|
* [Builds](builds/index.md): Automatically build container images from
|
||||||
GitHub and Bitbucket and push them to Docker Hub.
|
GitHub and Bitbucket and push them to Docker Hub.
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
---
|
---
|
||||||
description: Guidelines for Official Images on Docker Hub
|
description: Guidelines for Official Images on Docker Hub
|
||||||
keywords: Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, docs, official,image, documentation
|
keywords: Docker, docker, registry, accounts, plans, Dockerfile, Docker Hub, docs, official,image, documentation
|
||||||
title: Official Images on Docker Hub
|
title: Docker Official Images
|
||||||
redirect_from:
|
redirect_from:
|
||||||
- /docker-hub/official_repos/
|
- /docker-hub/official_repos/
|
||||||
---
|
---
|
||||||
|
|
||||||
The Docker [Official Images](https://hub.docker.com/search?q=&type=image&image_filter=official) are a
|
The [Docker Official Images](https://hub.docker.com/search?q=&type=image&image_filter=official){:target="_blank" rel="noopener" class="_"} are a
|
||||||
curated set of Docker repositories hosted on Docker Hub. They are
|
curated set of Docker repositories hosted on Docker Hub. They are
|
||||||
designed to:
|
designed to:
|
||||||
|
|
||||||
* Provide essential base OS repositories (for example,
|
* Provide essential base OS repositories (for example,
|
||||||
[ubuntu](https://hub.docker.com/_/ubuntu/),
|
[ubuntu](https://hub.docker.com/_/ubuntu/){:target="_blank" rel="noopener" class="_"},
|
||||||
[centos](https://hub.docker.com/_/centos/)) that serve as the
|
[centos](https://hub.docker.com/_/centos/){:target="_blank" rel="noopener" class="_"}) that serve as the
|
||||||
starting point for the majority of users.
|
starting point for the majority of users.
|
||||||
|
|
||||||
* Provide drop-in solutions for popular programming language runtimes, data
|
* Provide drop-in solutions for popular programming language runtimes, data
|
||||||
|
|
@ -24,17 +24,17 @@ designed to:
|
||||||
authors.
|
authors.
|
||||||
|
|
||||||
* Ensure that security updates are applied in a timely manner. This is
|
* Ensure that security updates are applied in a timely manner. This is
|
||||||
particularly important as Official Images are some of the most
|
particularly important as Docker Official Images are some of the most
|
||||||
popular on Docker Hub.
|
popular on Docker Hub.
|
||||||
|
|
||||||
Docker, Inc. sponsors a dedicated team that is responsible for reviewing and
|
Docker, Inc. sponsors a dedicated team that is responsible for reviewing and
|
||||||
publishing all content in the Official Images. This team works in
|
publishing all content in the Docker Official Images. This team works in
|
||||||
collaboration with upstream software maintainers, security experts, and the
|
collaboration with upstream software maintainers, security experts, and the
|
||||||
broader Docker community.
|
broader Docker community.
|
||||||
|
|
||||||
While it is preferable to have upstream software authors maintaining their
|
While it is preferable to have upstream software authors maintaining their
|
||||||
corresponding Official Images, this is not a strict requirement. Creating
|
corresponding Docker Official Images, this is not a strict requirement. Creating
|
||||||
and maintaining images for Official Images is a collaborative process. It takes
|
and maintaining images for Docker Official Images is a collaborative process. It takes
|
||||||
place openly on GitHub where participation is encouraged. Anyone can provide
|
place openly on GitHub where participation is encouraged. Anyone can provide
|
||||||
feedback, contribute code, suggest process changes, or even propose a new
|
feedback, contribute code, suggest process changes, or even propose a new
|
||||||
Official Image.
|
Official Image.
|
||||||
|
|
@ -43,14 +43,14 @@ Official Image.
|
||||||
>
|
>
|
||||||
> Docker Official Images are an intellectual property of Docker. Distributing Docker Official Images without a prior agreement can constitute a violation of [Docker Terms of Service](https://www.docker.com/legal/docker-terms-service){: target="blank" rel="noopener" class=“”}.
|
> Docker Official Images are an intellectual property of Docker. Distributing Docker Official Images without a prior agreement can constitute a violation of [Docker Terms of Service](https://www.docker.com/legal/docker-terms-service){: target="blank" rel="noopener" class=“”}.
|
||||||
|
|
||||||
## When to use Official Images
|
## When to use Docker Official Images
|
||||||
|
|
||||||
If you are new to Docker, we recommend that you use the Official Images in your
|
If you are new to Docker, we recommend that you use the Docker Official Images in your
|
||||||
projects. These images have clear documentation, promote best practices,
|
projects. These images have clear documentation, promote best practices,
|
||||||
and are designed for the most common use cases. Advanced users can
|
and are designed for the most common use cases. Advanced users can
|
||||||
review the Official Images as part of your `Dockerfile` learning process.
|
review Docker Official Images as part of your `Dockerfile` learning process.
|
||||||
|
|
||||||
A common rationale for diverging from Official Images is to optimize for
|
A common rationale for diverging from Docker Official Images is to optimize for
|
||||||
image size. For instance, many of the programming language stack images contain
|
image size. For instance, many of the programming language stack images contain
|
||||||
a complete build toolchain to support installation of modules that depend on
|
a complete build toolchain to support installation of modules that depend on
|
||||||
optimized code. An advanced user could build a custom image with just the
|
optimized code. An advanced user could build a custom image with just the
|
||||||
|
|
@ -64,39 +64,36 @@ insufficient, it is still recommended to inherit from an Official Image
|
||||||
base OS image to leverage the ongoing maintenance work, rather than duplicating
|
base OS image to leverage the ongoing maintenance work, rather than duplicating
|
||||||
these efforts.
|
these efforts.
|
||||||
|
|
||||||
## Submitting Feedback for Official Images
|
## Submitting Feedback for Docker Official Images
|
||||||
|
|
||||||
All Official Images contain a **User Feedback** section in their
|
All Docker Official Images contain a **User Feedback** section in their
|
||||||
documentation which covers the details for that specific repository. In most
|
documentation which covers the details for that specific repository. In most
|
||||||
cases, the GitHub repository which contains the Dockerfiles for an Official
|
cases, the GitHub repository which contains the Dockerfiles for an Official
|
||||||
Repository also has an active issue tracker. General feedback and support
|
Repository also has an active issue tracker. General feedback and support
|
||||||
questions should be directed to `#docker-library` on [Libera.Chat IRC](https://libera.chat).
|
questions should be directed to `#docker-library` on [Libera.Chat IRC](https://libera.chat).
|
||||||
|
|
||||||
## Creating an Official Image
|
## Creating a Docker Official Image
|
||||||
|
|
||||||
From a high level, an Official Image starts out as a proposal in the form
|
From a high level, an Official Image starts out as a proposal in the form
|
||||||
of a set of GitHub pull requests. Detailed and objective proposal
|
of a set of GitHub pull requests. Detailed and objective proposal
|
||||||
requirements are documented in the following GitHub repositories:
|
requirements are documented in the following GitHub repositories:
|
||||||
|
|
||||||
* [docker-library/official-images](https://github.com/docker-library/official-images)
|
* [docker-library/official-images](https://github.com/docker-library/official-images){:target="_blank" rel="noopener" class="_"}
|
||||||
|
|
||||||
* [docker-library/docs](https://github.com/docker-library/docs)
|
* [docker-library/docs](https://github.com/docker-library/docs){:target="_blank" rel="noopener" class="_"}
|
||||||
|
|
||||||
The Official Images team, with help from community contributors, formally
|
The Docker Official Images team, with help from community contributors, formally
|
||||||
review each proposal and provide feedback to the author. This initial review
|
review each proposal and provide feedback to the author. This initial review
|
||||||
process may require a bit of back-and-forth before the proposal is accepted.
|
process may require a bit of back-and-forth before the proposal is accepted.
|
||||||
|
|
||||||
There are also subjective considerations during the review process. These
|
There are also subjective considerations during the review process. These
|
||||||
subjective concerns boil down to the basic question: "is this image generally
|
subjective concerns boil down to the basic question: "is this image generally
|
||||||
useful?" For example, the [python](https://hub.docker.com/_/python/)
|
useful?" For example, the [python](https://hub.docker.com/_/python/){:target="_blank" rel="noopener" class="_"}
|
||||||
Official Image is "generally useful" to the larger Python developer
|
Docker Official Image is "generally useful" to the larger Python developer
|
||||||
community, whereas an obscure text adventure game written in Python last week is
|
community, whereas an obscure text adventure game written in Python last week is
|
||||||
not.
|
not.
|
||||||
|
|
||||||
Once a new proposal is accepted, the author is responsible for keeping
|
Once a new proposal is accepted, the author is responsible for keeping
|
||||||
their images up-to-date and responding to user feedback. The Official
|
their images up-to-date and responding to user feedback. The Official
|
||||||
Repositories team becomes responsible for publishing the images and
|
Repositories team becomes responsible for publishing the images and
|
||||||
documentation on Docker Hub. Updates to the Official Image follow the same
|
documentation on Docker Hub. Updates to the Docker Official Image follow the same pull request process, though with less review. The Docker Official Images team ultimately acts as a gatekeeper for all changes, which helps mitigate the risk of quality and security issues from being introduced.
|
||||||
pull request process, though with less review. The Official Images team
|
|
||||||
ultimately acts as a gatekeeper for all changes, which helps mitigate the risk
|
|
||||||
of quality and security issues from being introduced.
|
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ redirect_from:
|
||||||
|
|
||||||
The Docker Verified and Publisher Program enables Independent Software Vendors (ISVs), development tools vendors, and platform providers to distribute Dockerized content through Docker Hub.
|
The Docker Verified and Publisher Program enables Independent Software Vendors (ISVs), development tools vendors, and platform providers to distribute Dockerized content through Docker Hub.
|
||||||
|
|
||||||
Development teams rely on Docker Hub for application components to build new applications. The Docker differentiated content programs like the [Official Images](../official_images.md) and the Verified Publishers provide developers with validation that these images come from trusted sources, reducing the risk of pulling malicious images from the impostor repositories.
|
Development teams rely on Docker Hub for application components to build new applications. The Docker differentiated content programs like the [Docker Official Images](../official_images.md) and the Docker Verified Publishers provide developers with validation that these images come from trusted sources, reducing the risk of pulling malicious images from the impostor repositories.
|
||||||
|
|
||||||
The Verified Publisher badge included on the Docker Hub repositories indicates that these repositories are published by Docker partners that are part of the Verified Publisher program, and are qualified to be included in the developer secure supply chain. You can limit your repository search, when you use the Verified Publisher filter.
|
The **Verified Publisher** badge included on the Docker Hub repositories indicates that these repositories are published by Docker partners that are part of the Verified Publisher program, and are qualified to be included in the developer secure supply chain. You can limit your repository search, when you use the 'Verified Publisher' filter.
|
||||||
|
|
||||||
To find out more about the Docker Verified and Publisher Program and to sign up for a partnership with Docker, visit the [Verified Publisher Program](https://www.docker.com/partners/programs){:target="_blank" rel="noopener" class="_"} page.
|
To find out more about the Docker Verified and Publisher Program and to sign up for a partnership with Docker, visit the [Docker Verified Publisher Program](https://www.docker.com/partners/programs){:target="_blank" rel="noopener" class="_"} page.
|
||||||
|
|
||||||

|

|
||||||
|
|
@ -171,7 +171,7 @@ There you can see two example results: `centos` and `ansible/centos7-ansible`.
|
||||||
The second result shows that it comes from the public repository of a user,
|
The second result shows that it comes from the public repository of a user,
|
||||||
named `ansible/`, while the first result, `centos`, doesn't explicitly list a
|
named `ansible/`, while the first result, `centos`, doesn't explicitly list a
|
||||||
repository which means that it comes from the top-level namespace for
|
repository which means that it comes from the top-level namespace for
|
||||||
[official images](official_images.md). The `/` character separates
|
[Docker Official Images](official_images.md). The `/` character separates
|
||||||
a user's repository from the image name.
|
a user's repository from the image name.
|
||||||
|
|
||||||
Once you've found the image you want, you can download it with `docker pull <imagename>`:
|
Once you've found the image you want, you can download it with `docker pull <imagename>`:
|
||||||
|
|
|
||||||
|
|
@ -947,7 +947,7 @@ adapting your image to take advantage of Docker secrets. One way to do this is
|
||||||
to ensure that each parameter you pass to the image when creating the container
|
to ensure that each parameter you pass to the image when creating the container
|
||||||
can also be read from a file.
|
can also be read from a file.
|
||||||
|
|
||||||
Many of the official images in the
|
Many of the Docker Official Images in the
|
||||||
[Docker library](https://github.com/docker-library/), such as the
|
[Docker library](https://github.com/docker-library/), such as the
|
||||||
[wordpress](https://github.com/docker-library/wordpress/)
|
[wordpress](https://github.com/docker-library/wordpress/)
|
||||||
image used in the above examples, have been updated in this way.
|
image used in the above examples, have been updated in this way.
|
||||||
|
|
@ -1028,4 +1028,3 @@ for that secret data.
|
||||||
|
|
||||||
More information on short and long syntax for secrets can be found at
|
More information on short and long syntax for secrets can be found at
|
||||||
[Compose file version 3 reference](../../compose/compose-file/compose-file-v3.md#secrets).
|
[Compose file version 3 reference](../../compose/compose-file/compose-file-v3.md#secrets).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,38 +42,38 @@ see a few flaws in the Dockerfile below. But, don't worry. We'll go over them.
|
||||||
|
|
||||||
1. Create a file named `Dockerfile` in the same folder as the file `package.json` with the following contents.
|
1. Create a file named `Dockerfile` in the same folder as the file `package.json` with the following contents.
|
||||||
|
|
||||||
```dockerfile
|
```dockerfile
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
FROM node:12-alpine
|
FROM node:12-alpine
|
||||||
RUN apk add --no-cache python g++ make
|
RUN apk add --no-cache python g++ make
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN yarn install --production
|
RUN yarn install --production
|
||||||
CMD ["node", "src/index.js"]
|
CMD ["node", "src/index.js"]
|
||||||
```
|
```
|
||||||
|
|
||||||
Please check that the file `Dockerfile` has no file extension like `.txt`. Some editors may append this file extension automatically and this would result in an error in the next step.
|
Please check that the file `Dockerfile` has no file extension like `.txt`. Some editors may append this file extension automatically and this would result in an error in the next step.
|
||||||
|
|
||||||
2. If you haven't already done so, open a terminal and go to the `app` directory with the `Dockerfile`. Now build the container image using the `docker build` command.
|
2. If you haven't already done so, open a terminal and go to the `app` directory with the `Dockerfile`. Now build the container image using the `docker build` command.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker build -t getting-started .
|
$ docker build -t getting-started .
|
||||||
```
|
```
|
||||||
|
|
||||||
This command used the Dockerfile to build a new container image. You might
|
This command used the Dockerfile to build a new container image. You might
|
||||||
have noticed that a lot of "layers" were downloaded. This is because we instructed
|
have noticed that a lot of "layers" were downloaded. This is because we instructed
|
||||||
the builder that we wanted to start from the `node:12-alpine` image. But, since we
|
the builder that we wanted to start from the `node:12-alpine` image. But, since we
|
||||||
didn't have that on our machine, that image needed to be downloaded.
|
didn't have that on our machine, that image needed to be downloaded.
|
||||||
|
|
||||||
After the image was downloaded, we copied in our application and used `yarn` to
|
After the image was downloaded, we copied in our application and used `yarn` to
|
||||||
install our application's dependencies. The `CMD` directive specifies the default
|
install our application's dependencies. The `CMD` directive specifies the default
|
||||||
command to run when starting a container from this image.
|
command to run when starting a container from this image.
|
||||||
|
|
||||||
Finally, the `-t` flag tags our image. Think of this simply as a human-readable name
|
Finally, the `-t` flag tags our image. Think of this simply as a human-readable name
|
||||||
for the final image. Since we named the image `getting-started`, we can refer to that
|
for the final image. Since we named the image `getting-started`, we can refer to that
|
||||||
image when we run a container.
|
image when we run a container.
|
||||||
|
|
||||||
The `.` at the end of the `docker build` command tells that Docker should look for the `Dockerfile` in the current directory.
|
The `.` at the end of the `docker build` command tells that Docker should look for the `Dockerfile` in the current directory.
|
||||||
|
|
||||||
## Start an app container
|
## Start an app container
|
||||||
|
|
||||||
|
|
@ -81,21 +81,21 @@ Now that we have an image, let's run the application. To do so, we will use the
|
||||||
command (remember that from earlier?).
|
command (remember that from earlier?).
|
||||||
|
|
||||||
1. Start your container using the `docker run` command and specify the name of the image we
|
1. Start your container using the `docker run` command and specify the name of the image we
|
||||||
just created:
|
just created:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker run -dp 3000:3000 getting-started
|
$ docker run -dp 3000:3000 getting-started
|
||||||
```
|
```
|
||||||
|
|
||||||
Remember the `-d` and `-p` flags? We're running the new container in "detached" mode (in the
|
Remember the `-d` and `-p` flags? We're running the new container in "detached" mode (in the
|
||||||
background) and creating a mapping between the host's port 3000 to the container's port 3000.
|
background) and creating a mapping between the host's port 3000 to the container's port 3000.
|
||||||
Without the port mapping, we wouldn't be able to access the application.
|
Without the port mapping, we wouldn't be able to access the application.
|
||||||
|
|
||||||
2. After a few seconds, open your web browser to [http://localhost:3000](http://localhost:3000).
|
2. After a few seconds, open your web browser to [http://localhost:3000](http://localhost:3000).
|
||||||
You should see our app.
|
You should see our app.
|
||||||
|
|
||||||
{: style="width:450px;margin-top:20px;"}
|
{: style="width:450px;margin-top:20px;"}
|
||||||
{: .text-center }
|
{: .text-center }
|
||||||
|
|
||||||
3. Go ahead and add an item or two and see that it works as you expect. You can mark items as
|
3. Go ahead and add an item or two and see that it works as you expect. You can mark items as
|
||||||
complete and remove items. Your frontend is successfully storing items in the backend.
|
complete and remove items. Your frontend is successfully storing items in the backend.
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@ For now, we will create the network first and attach the MySQL container at star
|
||||||
|
|
||||||
If you are using PowerShell then use this command.
|
If you are using PowerShell then use this command.
|
||||||
|
|
||||||
```powershell
|
```console
|
||||||
docker run -d `
|
PS> docker run -d `
|
||||||
--network todo-app --network-alias mysql `
|
--network todo-app --network-alias mysql `
|
||||||
-v todo-mysql-data:/var/lib/mysql `
|
-v todo-mysql-data:/var/lib/mysql `
|
||||||
-e MYSQL_ROOT_PASSWORD=secret `
|
-e MYSQL_ROOT_PASSWORD=secret `
|
||||||
|
|
@ -80,7 +80,7 @@ For now, we will create the network first and attach the MySQL container at star
|
||||||
When the password prompt comes up, type in **secret**. In the MySQL shell, list the databases and verify
|
When the password prompt comes up, type in **secret**. In the MySQL shell, list the databases and verify
|
||||||
you see the `todos` database.
|
you see the `todos` database.
|
||||||
|
|
||||||
```cli
|
```console
|
||||||
mysql> SHOW DATABASES;
|
mysql> SHOW DATABASES;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -194,8 +194,8 @@ With all of that explained, let's start our dev-ready container!
|
||||||
|
|
||||||
If you are using PowerShell then use this command.
|
If you are using PowerShell then use this command.
|
||||||
|
|
||||||
```powershell
|
```console
|
||||||
docker run -dp 3000:3000 `
|
PS> docker run -dp 3000:3000 `
|
||||||
-w /app -v "$(pwd):/app" `
|
-w /app -v "$(pwd):/app" `
|
||||||
--network todo-app `
|
--network todo-app `
|
||||||
-e MYSQL_HOST=mysql `
|
-e MYSQL_HOST=mysql `
|
||||||
|
|
@ -209,8 +209,7 @@ With all of that explained, let's start our dev-ready container!
|
||||||
2. If we look at the logs for the container (`docker logs <container-id>`), we should see a message indicating it's
|
2. If we look at the logs for the container (`docker logs <container-id>`), we should see a message indicating it's
|
||||||
using the mysql database.
|
using the mysql database.
|
||||||
|
|
||||||
```
|
```console
|
||||||
# Previous log messages omitted
|
|
||||||
$ nodemon src/index.js
|
$ nodemon src/index.js
|
||||||
[nodemon] 1.19.2
|
[nodemon] 1.19.2
|
||||||
[nodemon] to restart at any time, enter `rs`
|
[nodemon] to restart at any time, enter `rs`
|
||||||
|
|
@ -231,7 +230,7 @@ With all of that explained, let's start our dev-ready container!
|
||||||
|
|
||||||
And in the mysql shell, run the following:
|
And in the mysql shell, run the following:
|
||||||
|
|
||||||
```plaintext
|
```console
|
||||||
mysql> select * from todo_items;
|
mysql> select * from todo_items;
|
||||||
+--------------------------------------+--------------------+-----------+
|
+--------------------------------------+--------------------+-----------+
|
||||||
| id | name | completed |
|
| id | name | completed |
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,8 @@ For Docker Desktop installation instructions, see [Install Docker Desktop on Mac
|
||||||
|
|
||||||
If you've already run the command to get started with the tutorial, congratulations! If not, open a command prompt or bash window, and run the command:
|
If you've already run the command to get started with the tutorial, congratulations! If not, open a command prompt or bash window, and run the command:
|
||||||
|
|
||||||
```cli
|
```console
|
||||||
docker run -d -p 80:80 docker/getting-started
|
$ docker run -d -p 80:80 docker/getting-started
|
||||||
```
|
```
|
||||||
|
|
||||||
You'll notice a few flags being used. Here's some more info on them:
|
You'll notice a few flags being used. Here's some more info on them:
|
||||||
|
|
|
||||||
10
js/docs.js
10
js/docs.js
|
|
@ -215,4 +215,14 @@ ready(() => {
|
||||||
const group = $(this).attr("data-group");
|
const group = $(this).attr("data-group");
|
||||||
$(`.nav-tabs > li > a[data-group='${ group }']`).tab("show");
|
$(`.nav-tabs > li > a[data-group='${ group }']`).tab("show");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.language-dockerfile span.k').tooltip({
|
||||||
|
title: function() {
|
||||||
|
let c = this.textContent;
|
||||||
|
this.style.cursor = 'help';
|
||||||
|
$(this).on('click', () => { window.location.href = "/engine/reference/builder/#"+c.toLowerCase()});
|
||||||
|
return 'Learn more about the "'+ c + '" Dockerfile command.'
|
||||||
|
},
|
||||||
|
placement: "auto"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue