Merge branch 'master' into build-secrets

This commit is contained in:
Usha Mandya 2021-04-23 10:26:25 +01:00 committed by GitHub
commit f47930bcb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 687 additions and 467 deletions

View File

@ -0,0 +1,22 @@
command: docker compose images
short: List images used by the created containers.
long: List images used by the created containers.
usage: docker compose images [options] [SERVICE...]
pname: docker compose
plink: docker_compose.yaml
options:
- option: quiet
shorthand: q
value_type: bool
default_value: "false"
description: Only display IDs
deprecated: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
deprecated: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false

View File

@ -526,6 +526,8 @@ reference:
title: docker compose events
- path: /engine/reference/commandline/compose_exec/
title: docker compose exec
- path: /engine/reference/commandline/compose_images/
title: docker compose images
- path: /engine/reference/commandline/compose_kill/
title: docker compose kill
- path: /engine/reference/commandline/compose_logs/
@ -946,7 +948,7 @@ reference:
title: docker wait
- sectiontitle: Docker Compose CLI reference
section:
- path: /compose/reference/overview/
- path: /compose/reference/
title: Overview of docker-compose CLI
- path: /compose/reference/envvars/
title: CLI environment variables
@ -966,6 +968,8 @@ reference:
title: docker-compose exec
- path: /compose/reference/help/
title: docker-compose help
- path: /compose/reference/images/
title: docker-compose images
- path: /compose/reference/kill/
title: docker-compose kill
- path: /compose/reference/logs/
@ -1134,25 +1138,25 @@ samples:
section:
- path: /samples/
title: Samples home
- path: /engine/examples/apt-cacher-ng/
- path: /samples/apt-cacher-ng/
title: apt-cacher-ng
- path: /engine/examples/dotnetcore/
- path: /samples/dotnetcore/
title: ASP.NET Core application
- path: /compose/aspnet-mssql-compose/
- path: /samples/aspnet-mssql-compose/
title: ASP.NET Core + SQL Server on Linux
- path: /engine/examples/couchdb_data_volumes/
- path: /samples/couchdb_data_volumes/
title: CouchDB
- path: /compose/django/
- path: /samples/django/
title: Django and PostgreSQL
- path: /compose/wordpress/
- path: /samples/wordpress/
title: WordPress
- path: /engine/examples/postgresql_service/
- path: /samples/postgresql_service/
title: PostgreSQL
- path: /compose/rails/
- path: /samples/rails/
title: Rails and PostgreSQL
- path: /engine/examples/running_riak_service/
- path: /samples/running_riak_service/
title: Riak
- path: /engine/examples/running_ssh_service/
- path: /samples/running_ssh_service/
title: SSHd
- path: /samples/#library-references
title: Library references

View File

@ -21,9 +21,9 @@
// Prevent selecting comments, command-output and command-prompt in shell
// examples that use the "console" lexer/highlighter to allow easier copying.
// See https://github.com/rouge-ruby/rouge/issues/1023
.highlight .c,
.highlight .go,
.highlight .gp
.language-console .highlight .c,
.language-console .highlight .go,
.language-console .highlight .gp
{
-webkit-user-select: none;
-moz-user-select: none;
@ -34,7 +34,7 @@
// Show a "text" cursor for the prompt. Even though the prompt itself is not
// selectable, make it appear as if it is, so that users don't get confused
// when they try to select an example for copying.
.highlight .gp {
.language-console .highlight .gp {
cursor: text;
}

View File

@ -182,11 +182,11 @@
"KeyPrefixEquals": "ee/licensing/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/licensing.html"
"ReplaceKeyWith": ""
}
},
{
@ -195,11 +195,11 @@
"KeyPrefixEquals": "ee/get-support/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/get-support.html"
"ReplaceKeyWith": ""
}
},
{
@ -208,11 +208,11 @@
"KeyPrefixEquals": "ee/cluster/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/cluster.html"
"ReplaceKeyWith": ""
}
},
{
@ -221,11 +221,11 @@
"KeyPrefixEquals": "ee/supported-platforms/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/dee-intro.html"
"ReplaceKeyWith": ""
}
},
{
@ -234,11 +234,11 @@
"KeyPrefixEquals": "ee/ucp/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/ucp.html"
"ReplaceKeyWith": ""
}
},
{
@ -247,11 +247,11 @@
"KeyPrefixEquals": "ee/dtr/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/dtr.html"
"ReplaceKeyWith": ""
}
},
{
@ -260,11 +260,11 @@
"KeyPrefixEquals": "compliance/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/compliance.html"
"ReplaceKeyWith": ""
}
},
{
@ -273,11 +273,11 @@
"KeyPrefixEquals": "datacenter/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v2.1/"
"ReplaceKeyWith": ""
}
},
{
@ -286,11 +286,11 @@
"KeyPrefixEquals": "v18.09/ee/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v2.1/"
"ReplaceKeyWith": ""
}
},
{
@ -299,11 +299,11 @@
"KeyPrefixEquals": "v18.03/ee/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v18.03/"
"ReplaceKeyWith": ""
}
},
{
@ -312,11 +312,11 @@
"KeyPrefixEquals": "v17.06/enterprise/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v2.0/"
"ReplaceKeyWith": ""
}
},
{
@ -325,11 +325,11 @@
"KeyPrefixEquals": "ee/docker-ee/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/docker-engine-enterprise/dee-linux.html"
"ReplaceKeyWith": ""
}
},
{
@ -338,11 +338,11 @@
"KeyPrefixEquals": "ee/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs-stage.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/index.html"
"ReplaceKeyWith": ""
}
},
{

View File

@ -182,11 +182,11 @@
"KeyPrefixEquals": "ee/licensing/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/licensing.html"
"ReplaceKeyWith": ""
}
},
{
@ -195,11 +195,11 @@
"KeyPrefixEquals": "ee/get-support/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/get-support.html"
"ReplaceKeyWith": ""
}
},
{
@ -208,11 +208,11 @@
"KeyPrefixEquals": "ee/cluster/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/cluster.html"
"ReplaceKeyWith": ""
}
},
{
@ -221,11 +221,11 @@
"KeyPrefixEquals": "ee/supported-platforms/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/dee-intro.html"
"ReplaceKeyWith": ""
}
},
{
@ -234,11 +234,11 @@
"KeyPrefixEquals": "ee/ucp/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/ucp.html"
"ReplaceKeyWith": ""
}
},
{
@ -247,11 +247,11 @@
"KeyPrefixEquals": "ee/dtr/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/dtr.html"
"ReplaceKeyWith": ""
}
},
{
@ -260,11 +260,11 @@
"KeyPrefixEquals": "compliance/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/compliance.html"
"ReplaceKeyWith": ""
}
},
{
@ -273,11 +273,11 @@
"KeyPrefixEquals": "datacenter/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v2.1/"
"ReplaceKeyWith": ""
}
},
{
@ -286,11 +286,11 @@
"KeyPrefixEquals": "v18.09/ee/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v2.1/"
"ReplaceKeyWith": ""
}
},
{
@ -299,11 +299,11 @@
"KeyPrefixEquals": "v18.03/ee/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v18.03/"
"ReplaceKeyWith": ""
}
},
{
@ -312,11 +312,11 @@
"KeyPrefixEquals": "v17.06/enterprise/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v2.0/"
"ReplaceKeyWith": ""
}
},
{
@ -325,11 +325,11 @@
"KeyPrefixEquals": "ee/docker-ee/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/docker-engine-enterprise/dee-linux.html"
"ReplaceKeyWith": ""
}
},
{
@ -338,11 +338,11 @@
"KeyPrefixEquals": "ee/"
},
"Redirect": {
"HostName": "docs.mirantis.com",
"HostName": "docs.docker.com",
"HttpRedirectCode": null,
"Protocol": "https",
"ReplaceKeyPrefixWith": null,
"ReplaceKeyWith": "docker-enterprise/v3.0/dockeree-products/index.html"
"ReplaceKeyWith": ""
}
},
{

View File

@ -148,6 +148,7 @@ inside your Dockerfile and can be leveraged by the processes running as part
of your build.
```dockerfile
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM golang:alpine AS build
ARG TARGETPLATFORM
ARG BUILDPLATFORM

View File

@ -182,6 +182,8 @@ build process.
First, specify the arguments in your Dockerfile:
```dockerfile
# syntax=docker/dockerfile:1
ARG buildno
ARG gitcommithash

View File

@ -247,6 +247,8 @@ build process.
First, specify the arguments in your Dockerfile:
```dockerfile
# syntax=docker/dockerfile:1
ARG buildno
ARG gitcommithash

View File

@ -31,7 +31,7 @@ the rules described in
To use multiple override files, or an override file with a different name, you
can use the `-f` option to specify the list of files. Compose merges files in
the order they're specified on the command line. See the
[`docker-compose` command reference](reference/overview.md) for more information
[`docker-compose` command reference](reference/index.md) for more information
about using `-f`.
When you use multiple configuration files, you must make sure all paths in the

View File

@ -57,7 +57,7 @@ handling `SIGTERM` properly.
Compose uses the project name to create unique identifiers for all of a
project's containers and other resources. To run multiple copies of a project,
set a custom project name using the [`-p` command line option](reference/overview.md)
set a custom project name using the [`-p` command line option](reference/index.md)
or the [`COMPOSE_PROJECT_NAME` environment variable](reference/envvars.md#compose_project_name).
## What's the difference between `up`, `run`, and `start`?

View File

@ -85,6 +85,7 @@ In your project directory, create a file named `Dockerfile` and paste the
following:
```dockerfile
# syntax=docker/dockerfile:1
FROM python:3.7-alpine
WORKDIR /code
ENV FLASK_APP=app.py

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

View File

@ -64,9 +64,9 @@ Compose has commands for managing the whole lifecycle of your application:
- [Installing Compose](install.md)
- [Getting started with Compose](gettingstarted.md)
- [Get started with Django](django.md)
- [Get started with Rails](rails.md)
- [Get started with WordPress](wordpress.md)
- [Get started with Django](../samples/django.md)
- [Get started with Rails](../samples/rails.md)
- [Get started with WordPress](../samples/wordpress.md)
- [Frequently asked questions](faq.md)
- [Command line reference](reference/index.md)
- [Compose file reference](compose-file/index.md)
@ -92,7 +92,7 @@ Compose uses a project name to isolate environments from each other. You can mak
The default project name is the basename of the project directory. You can set
a custom project name by using the
[`-p` command line option](reference/overview.md) or the
[`-p` command line option](reference/index.md) or the
[`COMPOSE_PROJECT_NAME` environment variable](reference/envvars.md#compose_project_name).
The default project directory is the base directory of the Compose file. A custom value

View File

@ -16,7 +16,7 @@ identical to the container name.
>
> Your app's network is given a name based on the "project name",
> which is based on the name of the directory it lives in. You can override the
> project name with either the [`--project-name` flag](reference/overview.md)
> project name with either the [`--project-name` flag](reference/index.md)
> or the [`COMPOSE_PROJECT_NAME` environment variable](reference/envvars.md#compose_project_name).
For example, suppose your app is in a directory called `myapp`, and your `docker-compose.yml` looks like this:

View File

@ -57,7 +57,7 @@ Valid profile names follow the regex format of `[a-zA-Z0-9][a-zA-Z0-9_.-]+`.
## Enabling profiles
To enable a profile supply the `--profile` [command-line option](reference/overview.md) or
To enable a profile supply the `--profile` [command-line option](reference/index.md) or
use the [`COMPOSE_PROFILES` environment variable](reference/envvars.md#compose_profiles):
```sh

View File

@ -21,7 +21,7 @@ includes two services `db` and `web`, then Compose starts containers named
Setting this is optional. If you do not set this, the `COMPOSE_PROJECT_NAME`
defaults to the `basename` of the project directory. See also the `-p`
[command-line option](overview.md).
[command-line option](index.md).
## COMPOSE\_FILE
@ -34,7 +34,7 @@ Linux and macOS the path separator is `:`, on Windows it is `;`). For example:
`COMPOSE_FILE=docker-compose.yml:docker-compose.prod.yml`. The path separator
can also be customized using `COMPOSE_PATH_SEPARATOR`.
See also the `-f` [command-line option](overview.md).
See also the `-f` [command-line option](index.md).
## COMPOSE\_PROFILES
@ -47,7 +47,7 @@ You can specify a list of profiles separated with a comma:
`debug`.
See also [_Using profiles with Compose_](../profiles.md) and the `--profile`
[command-line option](overview.md).
[command-line option](index.md#use---profile-to-specify-one-or-more-active-profiles).
## COMPOSE\_API\_VERSION

View File

@ -1,39 +1,203 @@
---
description: Compose CLI reference
keywords: fig, composition, compose, docker, orchestration, cli, reference
title: Compose command-line reference
notoc: true
description: Overview of docker-compose CLI
keywords: fig, composition, compose, docker, orchestration, cli, reference, docker-compose
redirect_from:
- /compose/reference/docker-compose/
- /compose/reference/overview/
title: Overview of docker-compose CLI
---
The following pages describe the usage information for the [docker-compose](overview.md) subcommands. You can also see this information by running `docker-compose [SUBCOMMAND] --help` from the command line.
This page provides the usage information for the `docker-compose` Command.
* [docker-compose](overview.md)
* [build](build.md)
* [config](config.md)
* [create](create.md)
* [down](down.md)
* [events](events.md)
* [exec](exec.md)
* [help](help.md)
* [images](images.md)
* [kill](kill.md)
* [logs](logs.md)
* [pause](pause.md)
* [port](port.md)
* [ps](ps.md)
* [pull](pull.md)
* [push](push.md)
* [restart](restart.md)
* [rm](rm.md)
* [run](run.md)
* [scale](scale.md)
* [start](start.md)
* [stop](stop.md)
* [top](top.md)
* [unpause](unpause.md)
* [up](up.md)
## Command options overview and help
You can also see this information by running `docker-compose --help` from the
command line.
```none
Define and run multi-container applications with Docker.
Usage:
docker-compose [-f <arg>...] [--profile <name>...] [options] [COMMAND] [ARGS...]
docker-compose -h|--help
Options:
-f, --file FILE Specify an alternate compose file
(default: docker-compose.yml)
-p, --project-name NAME Specify an alternate project name
(default: directory name)
--profile NAME Specify a profile to enable
--verbose Show more output
--log-level LEVEL Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
--no-ansi Do not print ANSI control characters
-v, --version Print version and exit
-H, --host HOST Daemon socket to connect to
--tls Use TLS; implied by --tlsverify
--tlscacert CA_PATH Trust certs signed only by this CA
--tlscert CLIENT_CERT_PATH Path to TLS certificate file
--tlskey TLS_KEY_PATH Path to TLS key file
--tlsverify Use TLS and verify the remote
--skip-hostname-check Don't check the daemon's hostname against the
name specified in the client certificate
--project-directory PATH Specify an alternate working directory
(default: the path of the Compose file)
--compatibility If set, Compose will attempt to convert deploy
keys in v3 files to their non-Swarm equivalent
Commands:
build Build or rebuild services
bundle Generate a Docker bundle from the Compose file
config Validate and view the Compose file
create Create services
down Stop and remove containers, networks, images, and volumes
events Receive real time events from containers
exec Execute a command in a running container
help Get help on a command
images List images
kill Kill containers
logs View output from containers
pause Pause services
port Print the public port for a port binding
ps List containers
pull Pull service images
push Push service images
restart Restart services
rm Remove stopped containers
run Run a one-off command
scale Set number of containers for a service
start Start services
stop Stop services
top Display the running processes
unpause Unpause services
up Create and start containers
version Show the Docker-Compose version information
```
You can use Docker Compose binary, `docker-compose [-f <arg>...] [options]
[COMMAND] [ARGS...]`, to build and manage multiple services in Docker containers.
## Use `-f` to specify name and path of one or more Compose files
Use the `-f` flag to specify the location of a Compose configuration file.
### Specifying multiple Compose files
You can supply multiple `-f` configuration files. When you supply multiple
files, Compose combines them into a single configuration. Compose builds the
configuration in the order you supply the files. Subsequent files override and
add to their predecessors.
For example, consider this command line:
```
$ docker-compose -f docker-compose.yml -f docker-compose.admin.yml run backup_db
```
The `docker-compose.yml` file might specify a `webapp` service.
```
webapp:
image: examples/web
ports:
- "8000:8000"
volumes:
- "/data"
```
If the `docker-compose.admin.yml` also specifies this same service, any matching
fields override the previous file. New values, add to the `webapp` service
configuration.
```
webapp:
build: .
environment:
- DEBUG=1
```
When you use multiple Compose files, all paths in the files are relative to the
first configuration file specified with `-f`. You can use the
`--project-directory` option to override this base path.
Use a `-f` with `-` (dash) as the filename to read the configuration from
`stdin`. When `stdin` is used all paths in the configuration are
relative to the current working directory.
The `-f` flag is optional. If you don't provide this flag on the command line,
Compose traverses the working directory and its parent directories looking for a
`docker-compose.yml` and a `docker-compose.override.yml` file. You must supply
at least the `docker-compose.yml` file. If both files are present on the same
directory level, Compose combines the two files into a single configuration.
The configuration in the `docker-compose.override.yml` file is applied over and
in addition to the values in the `docker-compose.yml` file.
### Specifying a path to a single Compose file
You can use the `-f` flag to specify a path to a Compose file that is not
located in the current directory, either from the command line or by setting up
a [COMPOSE_FILE environment variable](envvars.md#compose_file) in your shell or
in an environment file.
For an example of using the `-f` option at the command line, suppose you are
running the [Compose Rails sample](../../samples/rails.md), and
have a `docker-compose.yml` file in a directory called `sandbox/rails`. You can
use a command like [docker-compose pull](pull.md) to get the
postgres image for the `db` service from anywhere by using the `-f` flag as
follows: `docker-compose -f ~/sandbox/rails/docker-compose.yml pull db`
Here's the full example:
```
$ docker-compose -f ~/sandbox/rails/docker-compose.yml pull db
Pulling db (postgres:latest)...
latest: Pulling from library/postgres
ef0380f84d05: Pull complete
50cf91dc1db8: Pull complete
d3add4cd115c: Pull complete
467830d8a616: Pull complete
089b9db7dc57: Pull complete
6fba0a36935c: Pull complete
81ef0e73c953: Pull complete
338a6c4894dc: Pull complete
15853f32f67c: Pull complete
044c83d92898: Pull complete
17301519f133: Pull complete
dcca70822752: Pull complete
cecf11b8ccf3: Pull complete
Digest: sha256:1364924c753d5ff7e2260cd34dc4ba05ebd40ee8193391220be0f9901d4e1651
Status: Downloaded newer image for postgres:latest
```
## Use `-p` to specify a project name
Each configuration has a project name. If you supply a `-p` flag, you can
specify a project name. If you don't specify the flag, Compose uses the current
directory name. See also the [COMPOSE_PROJECT_NAME environment variable](envvars.md#compose_project_name).
## Use `--profile` to specify one or more active profiles
Calling `docker-compose --profile frontend up` will start the services with the
profile `frontend` and services without specified profiles. You can also enable
multiple profiles, e.g. with `docker-compose --profile frontend --profile debug up`
the profiles `frontend` and `debug` will be enabled.
See also [_Using profiles with Compose_](../profiles.md) and the
[`COMPOSE_PROFILES` environment variable](envvars.md#compose_profiles).
## Set up environment variables
You can set [environment variables](envvars.md) for various
`docker-compose` options, including the `-f` and `-p` flags.
For example, the [COMPOSE_FILE environment variable](envvars.md#compose_file)
relates to the `-f` flag, and `COMPOSE_PROJECT_NAME`
[environment variable](envvars.md#compose_project_name) relates to the `-p` flag.
Also, you can set some of these variables in an [environment file](../env-file.md).
## Where to go next
* [CLI environment variables](envvars.md)
* [docker-compose Command](overview.md)
* [Declare default environment variables in file](../env-file.md)

View File

@ -1,202 +0,0 @@
---
description: Overview of docker-compose CLI
keywords: fig, composition, compose, docker, orchestration, cli, docker-compose
redirect_from:
- /compose/reference/docker-compose/
title: Overview of docker-compose CLI
---
This page provides the usage information for the `docker-compose` Command.
## Command options overview and help
You can also see this information by running `docker-compose --help` from the
command line.
```none
Define and run multi-container applications with Docker.
Usage:
docker-compose [-f <arg>...] [--profile <name>...] [options] [COMMAND] [ARGS...]
docker-compose -h|--help
Options:
-f, --file FILE Specify an alternate compose file
(default: docker-compose.yml)
-p, --project-name NAME Specify an alternate project name
(default: directory name)
--profile NAME Specify a profile to enable
--verbose Show more output
--log-level LEVEL Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
--no-ansi Do not print ANSI control characters
-v, --version Print version and exit
-H, --host HOST Daemon socket to connect to
--tls Use TLS; implied by --tlsverify
--tlscacert CA_PATH Trust certs signed only by this CA
--tlscert CLIENT_CERT_PATH Path to TLS certificate file
--tlskey TLS_KEY_PATH Path to TLS key file
--tlsverify Use TLS and verify the remote
--skip-hostname-check Don't check the daemon's hostname against the
name specified in the client certificate
--project-directory PATH Specify an alternate working directory
(default: the path of the Compose file)
--compatibility If set, Compose will attempt to convert deploy
keys in v3 files to their non-Swarm equivalent
Commands:
build Build or rebuild services
bundle Generate a Docker bundle from the Compose file
config Validate and view the Compose file
create Create services
down Stop and remove containers, networks, images, and volumes
events Receive real time events from containers
exec Execute a command in a running container
help Get help on a command
images List images
kill Kill containers
logs View output from containers
pause Pause services
port Print the public port for a port binding
ps List containers
pull Pull service images
push Push service images
restart Restart services
rm Remove stopped containers
run Run a one-off command
scale Set number of containers for a service
start Start services
stop Stop services
top Display the running processes
unpause Unpause services
up Create and start containers
version Show the Docker-Compose version information
```
You can use Docker Compose binary, `docker-compose [-f <arg>...] [options]
[COMMAND] [ARGS...]`, to build and manage multiple services in Docker containers.
## Use `-f` to specify name and path of one or more Compose files
Use the `-f` flag to specify the location of a Compose configuration file.
### Specifying multiple Compose files
You can supply multiple `-f` configuration files. When you supply multiple
files, Compose combines them into a single configuration. Compose builds the
configuration in the order you supply the files. Subsequent files override and
add to their predecessors.
For example, consider this command line:
```
$ docker-compose -f docker-compose.yml -f docker-compose.admin.yml run backup_db
```
The `docker-compose.yml` file might specify a `webapp` service.
```
webapp:
image: examples/web
ports:
- "8000:8000"
volumes:
- "/data"
```
If the `docker-compose.admin.yml` also specifies this same service, any matching
fields override the previous file. New values, add to the `webapp` service
configuration.
```
webapp:
build: .
environment:
- DEBUG=1
```
When you use multiple Compose files, all paths in the files are relative to the
first configuration file specified with `-f`. You can use the
`--project-directory` option to override this base path.
Use a `-f` with `-` (dash) as the filename to read the configuration from
`stdin`. When `stdin` is used all paths in the configuration are
relative to the current working directory.
The `-f` flag is optional. If you don't provide this flag on the command line,
Compose traverses the working directory and its parent directories looking for a
`docker-compose.yml` and a `docker-compose.override.yml` file. You must supply
at least the `docker-compose.yml` file. If both files are present on the same
directory level, Compose combines the two files into a single configuration.
The configuration in the `docker-compose.override.yml` file is applied over and
in addition to the values in the `docker-compose.yml` file.
### Specifying a path to a single Compose file
You can use the `-f` flag to specify a path to a Compose file that is not
located in the current directory, either from the command line or by setting up
a [COMPOSE_FILE environment variable](envvars.md#compose_file) in your shell or
in an environment file.
For an example of using the `-f` option at the command line, suppose you are
running the [Compose Rails sample](../rails.md), and
have a `docker-compose.yml` file in a directory called `sandbox/rails`. You can
use a command like [docker-compose pull](pull.md) to get the
postgres image for the `db` service from anywhere by using the `-f` flag as
follows: `docker-compose -f ~/sandbox/rails/docker-compose.yml pull db`
Here's the full example:
```
$ docker-compose -f ~/sandbox/rails/docker-compose.yml pull db
Pulling db (postgres:latest)...
latest: Pulling from library/postgres
ef0380f84d05: Pull complete
50cf91dc1db8: Pull complete
d3add4cd115c: Pull complete
467830d8a616: Pull complete
089b9db7dc57: Pull complete
6fba0a36935c: Pull complete
81ef0e73c953: Pull complete
338a6c4894dc: Pull complete
15853f32f67c: Pull complete
044c83d92898: Pull complete
17301519f133: Pull complete
dcca70822752: Pull complete
cecf11b8ccf3: Pull complete
Digest: sha256:1364924c753d5ff7e2260cd34dc4ba05ebd40ee8193391220be0f9901d4e1651
Status: Downloaded newer image for postgres:latest
```
## Use `-p` to specify a project name
Each configuration has a project name. If you supply a `-p` flag, you can
specify a project name. If you don't specify the flag, Compose uses the current
directory name. See also the [COMPOSE_PROJECT_NAME environment variable](envvars.md#compose_project_name).
## Use `--profile` to specify one or more active profiles
Calling `docker-compose --profile frontend up` will start the services with the
profile `frontend` and services without specified profiles. You can also enable
multiple profiles, e.g. with `docker-compose --profile frontend --profile debug up`
the profiles `frontend` and `debug` will be enabled.
See also [_Using profiles with Compose_](../profiles.md) and the
[`COMPOSE_PROFILES` environment variable](envvars.md#compose_profiles).
## Set up environment variables
You can set [environment variables](envvars.md) for various
`docker-compose` options, including the `-f` and `-p` flags.
For example, the [COMPOSE_FILE environment variable](envvars.md#compose_file)
relates to the `-f` flag, and `COMPOSE_PROJECT_NAME`
[environment variable](envvars.md#compose_project_name) relates to the `-p` flag.
Also, you can set some of these variables in an [environment file](../env-file.md).
## Where to go next
* [CLI environment variables](envvars.md)
* [Declare default environment variables in file](../env-file.md)

View File

@ -18,7 +18,7 @@ Options:
Pulls an image associated with a service defined in a `docker-compose.yml` or `docker-stack.yml` file, but does not start containers based on those images.
For example, suppose you have this `docker-compose.yml` file from the [Quickstart: Compose and Rails](../rails.md) sample.
For example, suppose you have this `docker-compose.yml` file from the [Quickstart: Compose and Rails](../../samples/rails.md) sample.
```yaml
version: '2'

View File

@ -24,12 +24,12 @@ The samples should help you to:
These samples focus specifically on Docker Compose:
- [Quickstart: Compose and Django](django.md) - Shows how to use Docker Compose to set up and run a simple Django/PostgreSQL app.
- [Quickstart: Compose and Django](../samples/django.md) - Shows how to use Docker Compose to set up and run a simple Django/PostgreSQL app.
- [Quickstart: Compose and Rails](rails.md) - Shows how to use
- [Quickstart: Compose and Rails](../samples/rails.md) - Shows how to use
Docker Compose to set up and run a Rails/PostgreSQL app.
- [Quickstart: Compose and WordPress](wordpress.md) - Shows how to
- [Quickstart: Compose and WordPress](../samples/wordpress.md) - Shows how to
use Docker Compose to set up and run WordPress in an isolated environment
with Docker containers.

View File

@ -76,6 +76,7 @@ this in a few different ways.
Next, the Dockerfile:
```dockerfile
# syntax=docker/dockerfile:1
FROM ubuntu:latest
COPY my_first_process my_first_process
COPY my_second_process my_second_process
@ -110,6 +111,7 @@ this in a few different ways.
```
```dockerfile
# syntax=docker/dockerfile:1
FROM ubuntu:latest
COPY my_main_process my_main_process
COPY my_helper_process my_helper_process
@ -127,6 +129,7 @@ this in a few different ways.
Dockerfile.
```dockerfile
# syntax=docker/dockerfile:1
FROM ubuntu:latest
RUN apt-get update && apt-get install -y supervisor
RUN mkdir -p /var/log/supervisor

View File

@ -49,7 +49,7 @@ Let's start a sample application. Download the [Example voting app](https://gith
To start the application, navigate to the directory containing the example voting application in the CLI and run `docker-compose up --build`.
```shell
```console
$ docker-compose up --build
Creating network "example-voting-app-master_front-tier" with the default driver
Creating network "example-voting-app-master_back-tier" with the default driver

View File

@ -62,6 +62,7 @@ in your `Dockerfile`. For example, to create a minimal container using
`scratch`:
```dockerfile
# syntax=docker/dockerfile:1
FROM scratch
ADD hello /
CMD ["/hello"]

View File

@ -19,7 +19,8 @@ on performance, storage management, feature functionality, and security.
information for building new images with a specified Dockerfile
For more information on build options, see the reference guide on the
[command line build options](/engine/reference/commandline/build/).
[command line build options](../../engine/reference/commandline/build.md) and
the [Dockerfile reference](/engine/reference/builder/) page.
## Requirements
@ -115,9 +116,16 @@ frontend. To override the default frontend, set the first line of the
`Dockerfile` as a comment with a specific frontend image:
```dockerfile
# syntax = <frontend image>, e.g. # syntax = docker/dockerfile:1.2
# syntax=<frontend image>, e.g. # syntax=docker/dockerfile:1.2
```
The examples on this page use features that are available in `docker/dockerfile`
version 1.2.0 and up. We recommend using `docker/dockerfile:1`, which always
points to the latest release of the version 1 syntax. BuildKit automatically
checks for updates of the syntax before building, making sure you are using the
most current version. Learn more about the `syntax` directive in the
[Dockerfile reference](/engine/reference/builder/#syntax).
## New Docker Build secret information
The new `--secret` flag for docker build allows the user to pass secret
@ -142,7 +150,8 @@ And with a Dockerfile that specifies use of a BuildKit frontend
`docker/dockerfile:1.2`, the secret can be accessed when performing a `RUN`:
```dockerfile
# syntax = docker/dockerfile:1.2
# syntax=docker/dockerfile:1.2
FROM alpine
# shows secret from default secret location:
@ -201,7 +210,7 @@ make programs relying on SSH automatically use that socket.
Here is an example Dockerfile using SSH in the container:
```dockerfile
# syntax=docker/dockerfile:experimental
# syntax=docker/dockerfile:1
FROM alpine
# Install ssh client and git

View File

@ -23,6 +23,7 @@ Dockerfile instruction. The layers are stacked and each one is a delta of the
changes from the previous layer. Consider this `Dockerfile`:
```dockerfile
# syntax=docker/dockerfile:1
FROM ubuntu:18.04
COPY . /app
RUN make /app
@ -271,7 +272,8 @@ frequently changed:
A Dockerfile for a Go application could look like:
```dockerfile
FROM golang:1.11-alpine AS build
# syntax=docker/dockerfile:1
FROM golang:1.16-alpine AS build
# Install tools required for project
# Run `docker build --no-cache .` to update dependencies
@ -485,6 +487,7 @@ subsequent `apt-get install` instructions fail. For example, say you have a
Dockerfile:
```dockerfile
# syntax=docker/dockerfile:1
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y curl
@ -494,6 +497,7 @@ After building the image, all layers are in the Docker cache. Suppose you later
modify `apt-get install` by adding extra package:
```dockerfile
# syntax=docker/dockerfile:1
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y curl nginx
@ -653,6 +657,7 @@ still persists in this layer and its value can be dumped. You can test this by
creating a Dockerfile like the following, and then building it.
```dockerfile
# syntax=docker/dockerfile:1
FROM alpine
ENV ADMIN_USER="mark"
RUN echo $ADMIN_USER > ./mark
@ -674,6 +679,7 @@ improves readability. You could also put all of the commands into a shell script
and have the `RUN` command just run that shell script.
```dockerfile
# syntax=docker/dockerfile:1
FROM alpine
RUN export ADMIN_USER="mark" \
&& echo $ADMIN_USER > ./mark \

View File

@ -37,7 +37,8 @@ builder pattern above:
**`Dockerfile.build`**:
```dockerfile
FROM golang:1.7.3
# syntax=docker/dockerfile:1
FROM golang:1.16
WORKDIR /go/src/github.com/alexellis/href-counter/
COPY app.go .
RUN go get -d -v golang.org/x/net/html \
@ -52,6 +53,7 @@ and forget to continue the line using the `\` character, for example.
**`Dockerfile`**:
```dockerfile
# syntax=docker/dockerfile:1
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
@ -97,7 +99,8 @@ multi-stage builds.
**`Dockerfile`**:
```dockerfile
FROM golang:1.7.3
# syntax=docker/dockerfile:1
FROM golang:1.16
WORKDIR /go/src/github.com/alexellis/href-counter/
RUN go get -d -v golang.org/x/net/html
COPY app.go .
@ -136,7 +139,8 @@ the `COPY` instruction. This means that even if the instructions in your
Dockerfile are re-ordered later, the `COPY` doesn't break.
```dockerfile
FROM golang:1.7.3 AS builder
# syntax=docker/dockerfile:1
FROM golang:1.16 AS builder
WORKDIR /go/src/github.com/alexellis/href-counter/
RUN go get -d -v golang.org/x/net/html
COPY app.go .
@ -185,14 +189,15 @@ COPY --from=nginx:latest /etc/nginx/nginx.conf /nginx.conf
You can pick up where a previous stage left off by referring to it when using the `FROM` directive. For example:
```dockerfile
FROM alpine:latest as builder
# syntax=docker/dockerfile:1
FROM alpine:latest AS builder
RUN apk --no-cache add build-base
FROM builder as build1
FROM builder AS build1
COPY source1.cpp source.cpp
RUN g++ -o /binary source.cpp
FROM builder as build2
FROM builder AS build2
COPY source2.cpp source.cpp
RUN g++ -o /binary source.cpp
```

View File

@ -27,8 +27,8 @@ most benefits from Docker.
- [Docker for Java developers lab](https://github.com/docker/labs/tree/master/developer-tools/java/){: target="_blank" rel="noopener" class="_"}
- [Port a node.js app to Docker lab](https://github.com/docker/labs/tree/master/developer-tools/nodejs/porting){: target="_blank" rel="noopener" class="_"}
- [Ruby on Rails app on Docker lab](https://github.com/docker/labs/tree/master/developer-tools/ruby){: target="_blank" rel="noopener" class="_"}
- [Dockerize a .Net Core application](../engine/examples/dotnetcore.md){: target="_blank" rel="noopener" class="_"}
- [Dockerize an ASP.NET Core application with SQL Server on Linux](../compose/aspnet-mssql-compose.md){: target="_blank" rel="noopener" class="_"} using Docker Compose
- [Dockerize a .Net Core application](../samples/dotnetcore.md){: target="_blank" rel="noopener" class="_"}
- [Dockerize an ASP.NET Core application with SQL Server on Linux](../samples/aspnet-mssql-compose.md){: target="_blank" rel="noopener" class="_"} using Docker Compose
## Advanced development with the SDK or API

View File

@ -6,6 +6,7 @@ redirect_from:
- /docker-for-windows/started/
- /engine/installation/windows/
- /installation/windows/
- /win/
- /windows/
- /windows/started/
- /winkit/

View File

@ -190,6 +190,41 @@ definitions:
type: string
enum: [active, inactive]
example: active
GetNamespaceRepositoryImagesTagsResponse:
description: Paginated list of tags for this repository.
type: object
properties:
count:
description: Total count of tags for this image.
type: integer
example: 100
next:
description: Link to the next page if there are more tags.
type: string
example: https://hub.docker.com/v2/namespaces/mynamespace/repositories/myrepo/images/sha256:mydigest/tags?&page=4&page_size=20
x-nullable: true
previous:
description: Link to the previous page if not on first page.
type: string
example: https://hub.docker.com/v2/namespaces/mynamespace/repositories/myrepo/images/sha256:mydigest/tags?&page=2&page_size=20
x-nullable: true
results:
description: The current and historical tags for this image.
type: array
items:
type: object
properties:
tag:
description: The tag.
type: string
example: latest
is_current:
description: |
`true` if the tag currently points to this image.
`false` if it has been overwritten to point at a different image.
type: boolean
example: true
PostNamespacesDeleteImagesRequest:
description: Delete images request.
type: object
@ -562,6 +597,53 @@ paths:
description: Success
schema:
$ref: '#/definitions/GetNamespaceRepositoryImagesResponse'
401:
description: Unauthorized - user does not have read access to the namespace.
schema:
$ref: '#/definitions/ErrorResponse'
403:
description: Forbidden - this API is only available to users on Pro or Team plans.
schema:
$ref: '#/definitions/ErrorResponse'
/v2/namespaces/{namespace}/repositories/{repository}/images/{digest}/tags:
get:
tags: [Images]
summary: Get image's tags
description: Gets current and historical tags for an image.
operationId: GetNamespacesRepositoriesImagesTags
produces:
- application/json
parameters:
- name: namespace
in: path
required: true
description: Namespace of the repository.
type: string
- name: repository
in: path
required: true
description: Name of the repository.
type: string
- name: digest
in: path
required: true
description: Digest of the image.
type: string
- name: page
in: query
required: false
description: Page number to get. Defaults to 1.
type: integer
- name: page_size
in: query
required: false
description: Number of images to get per page. Defaults to 10. Max of 100.
type: integer
responses:
200:
description: Success
schema:
$ref: '#/definitions/GetNamespaceRepositoryImagesTagsResponse'
401:
description: Unauthorized - user does not have read access to the namespace
schema:

View File

@ -1,15 +0,0 @@
---
description: Provides examples for using Docker
keywords: dockerize, dockerizing apps, dockerizing applications, container, containers
title: Dockerize an application
redirect_from:
- /en/latest/examples/
---
This section contains the following:
* [Dockerizing PostgreSQL](postgresql_service.md)
* [Dockerizing a CouchDB service](couchdb_data_volumes.md)
* [Dockerizing an apt-cacher-ng service](apt-cacher-ng.md)
* [Dockerizing an ASP.NET Core application](dotnetcore.md)
* [Get Started](/get-started/)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

View File

@ -0,0 +1,12 @@
---
datafolder: compose-cli
datafile: docker_compose_images
title: docker compose images
---
<!--
Sorry, but the contents of this page are automatically generated from
Docker's source code. If you want to suggest a change to the text that appears
here, you'll need to find the string by searching this repo:
https://github.com/docker/compose-cli
-->
{% include cli.md datafolder=page.datafolder datafile=page.datafile %}

View File

@ -386,4 +386,4 @@ The high-level `docker scan` command scans local images using the image name or
## Feedback
Thank you for trying out the vulnerability scanning for Docker local images. Your feedback is very important to us. Let us know your feedback by creating an issue in the [scan-cli-plugin](https://github.com/docker/cli-scan-feedback/issues/new){: target="_blank" rel="noopener" class="_"} GitHub repository.
Your feedback is very important to us. Let us know your feedback by creating an issue in the [scan-cli-plugin](https://github.com/docker/scan-cli-plugin/issues/new){: target="_blank" rel="noopener" class="_"} GitHub repository.

View File

@ -75,6 +75,7 @@ you should set the environment variable `DOCKER_CONTENT_TRUST` either manually o
in a scripted fashion. Consider the simple Dockerfile below.
```dockerfile
# syntax=docker/dockerfile:1
FROM docker/trusttest:latest
RUN echo
```

View File

@ -105,6 +105,7 @@ counter whenever you visit it.
4. Create a file called `Dockerfile` and paste this in:
```dockerfile
# syntax=docker/dockerfile:1
FROM python:3.4-alpine
ADD . /code
WORKDIR /code

View File

@ -43,6 +43,7 @@ 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.
```dockerfile
# syntax=docker/dockerfile:1
FROM node:12-alpine
RUN apk add --no-cache python g++ make
WORKDIR /app

View File

@ -100,6 +100,7 @@ times for your container images.
Let's look at the Dockerfile we were using one more time...
```dockerfile
# syntax=docker/dockerfile:1
FROM node:12-alpine
WORKDIR /app
COPY . .
@ -119,6 +120,7 @@ a change to the `package.json`. Make sense?
1. Update the Dockerfile to copy in the `package.json` first, install dependencies, and then copy everything else in.
```dockerfile
# syntax=docker/dockerfile:1
FROM node:12-alpine
WORKDIR /app
COPY package.json yarn.lock ./
@ -229,6 +231,7 @@ that JDK isn't needed in production. Also, you might be using tools like Maven o
Those also aren't needed in our final image. Multi-stage builds help.
```dockerfile
# syntax=docker/dockerfile:1
FROM maven AS build
WORKDIR /app
COPY . .
@ -249,6 +252,7 @@ and more into static HTML, JS, and CSS. If we aren't doing server-side rendering
for our production build. Why not ship the static resources in a static nginx container?
```dockerfile
# syntax=docker/dockerfile:1
FROM node:12 AS build
WORKDIR /app
COPY package* yarn.lock ./

View File

@ -18,6 +18,8 @@ redirect_from:
- /engine/getstarted/step_six/
- /engine/getstarted/step_three/
- /engine/getstarted/step_two/
- /engine/quickstart/
- /engine/tutorials/
- /engine/tutorials/dockerimages/
- /engine/tutorials/dockerizing/
- /engine/tutorials/usingdocker/

View File

@ -87,9 +87,27 @@ Lets walk through the process of creating a Dockerfile for our application. I
>
> The name of the Dockerfile is not important but the default filename for many commands is simply `Dockerfile`. So, well use that as our filename throughout this series.
The first thing we need to do is to add a line in our Dockerfile that tells Docker what base image we would like to use for our application.
The first line to add to the Dockerfile is a [`# syntax` parser directive](/engine/reference/builder/#syntax).
While _optional_, this directive instructs the Docker builder what syntax to use
when parsing the Dockerfile, and allows older Docker versions with BuildKit enabled
to upgrade the parser before starting the build. [Parser directives](/engine/reference/builder/#parser-directives)
must appear before any other comment, whitespace, or Dockerfile instruction in
your Dockerfile, should be the first line in Dockerfiles.
```dockerfile
# syntax=docker/dockerfile:1
```
We recommend using `docker/dockerfile:1`, which always points to the latest release
of the version 1 syntax. BuildKit automatically checks for updates of the syntax
before building, making sure you are using the most current version.
Next, we need to add a line in our Dockerfile that tells Docker what base image
we would like to use for our application.
```dockerfile
# syntax=docker/dockerfile:1
FROM node:12.18.1
```
@ -146,6 +164,8 @@ CMD [ "node", "server.js" ]
Here's the complete Dockerfile.
```dockerfile
# syntax=docker/dockerfile:1
FROM node:12.18.1
ENV NODE_ENV=production

View File

@ -87,9 +87,27 @@ Lets walk through the process of creating a Dockerfile for our application. I
>
> The name of the Dockerfile is not important but the default filename for many commands is simply `Dockerfile`. So, well use that as our filename throughout this series.
The first thing we need to do is to add a line in our Dockerfile that tells Docker what base image we would like to use for our application.
The first line to add to the Dockerfile is a [`# syntax` parser directive](/engine/reference/builder/#syntax).
While _optional_, this directive instructs the Docker builder what syntax to use
when parsing the Dockerfile, and allows older Docker versions with BuildKit enabled
to upgrade the parser before starting the build. [Parser directives](/engine/reference/builder/#parser-directives)
must appear before any other comment, whitespace, or Dockerfile instruction in
your Dockerfile, should be the first line in Dockerfiles.
```dockerfile
# syntax=docker/dockerfile:1
```
We recommend using `docker/dockerfile:1`, which always points to the latest release
of the version 1 syntax. BuildKit automatically checks for updates of the syntax
before building, making sure you are using the most current version.
Next, we need to add a line in our Dockerfile that tells Docker what base image
we would like to use for our application.
```dockerfile
# syntax=docker/dockerfile:1
FROM node:12.18.1
```
@ -146,6 +164,8 @@ CMD [ "node", "server.js" ]
Here's the complete Dockerfile.
```dockerfile
# syntax=docker/dockerfile:1
FROM node:12.18.1
ENV NODE_ENV=production

View File

@ -110,6 +110,7 @@ Creating node-docker_notes_run ...
In addition to running the tests on command, we can run them when we build our image, using a multi-stage Dockerfile. The following Dockerfile will run our tests and build our production image.
```dockerfile
# syntax=docker/dockerfile:1
FROM node:14.15.4 as base
WORKDIR /code
@ -166,6 +167,7 @@ This is great but at the moment we have to run two docker commands to build and
Update your Dockerfile with the highlighted line below.
```dockerfile
# syntax=docker/dockerfile:1
FROM node:14.15.4 as base
WORKDIR /code
@ -186,8 +188,8 @@ CMD [ "node", "server.js" ]
Now to run our tests, we just need to run the docker build command as above.
```dockerfile
docker build -t node-docker --target test .
```console
$ docker build -t node-docker --target test .
Sending build context to Docker daemon 22.35MB
Step 1/8 : FROM node:14.15.4 as base
---> f5be1883c8e0
@ -235,8 +237,8 @@ Open the test/test.js fiole and change line 5 as follows.
Now, run the same docker build command from above and observe that the build fails and the failing testing information is printed to the console.
```shell
docker build -t node-docker --target test .
```console
$ docker build -t node-docker --target test .
Sending build context to Docker daemon 22.35MB
Step 1/8 : FROM node:14.15.4 as base
---> 995ff80c793e

View File

@ -70,9 +70,27 @@ Lets walk through creating a Dockerfile for our application. In the root of y
>
> The name of the Dockerfile is not important but the default filename for many commands is simply `Dockerfile`. Therefore, well use that as our filename throughout this series.
The first thing we need to do is to add a line in our Dockerfile that tells Docker what base image we would like to use for our application.
The first line to add to the Dockerfile is a [`# syntax` parser directive](/engine/reference/builder/#syntax).
While _optional_, this directive instructs the Docker builder what syntax to use
when parsing the Dockerfile, and allows older Docker versions with BuildKit enabled
to upgrade the parser before starting the build. [Parser directives](/engine/reference/builder/#parser-directives)
must appear before any other comment, whitespace, or Dockerfile instruction in
your Dockerfile, should be the first line in Dockerfiles.
```dockerfile
# syntax=docker/dockerfile:1
```
We recommend using `docker/dockerfile:1`, which always points to the latest release
of the version 1 syntax. BuildKit automatically checks for updates of the syntax
before building, making sure you are using the most current version.
Next, we need to add a line in our Dockerfile that tells Docker what base image
we would like to use for our application.
```dockerfile
# syntax=docker/dockerfile:1
FROM python:3.8-slim-buster
```
@ -117,6 +135,8 @@ CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]
Here's the complete Dockerfile.
```dockerfile
# syntax=docker/dockerfile:1
FROM python:3.8-slim-buster
WORKDIR /app

View File

@ -18,27 +18,27 @@ on GitHub.
If you are running **macOS**:
```console
$ base=https://github.com/docker/machine/releases/download/v{{site.machine_version}} &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine
$ base=https://github.com/docker/machine/releases/download/v{{site.machine_version}} \
&& curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-machine \
&& chmod +x /usr/local/bin/docker-machine
```
If you are running **Linux**:
```console
$ base=https://github.com/docker/machine/releases/download/v{{site.machine_version}} &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
sudo mv /tmp/docker-machine /usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine
$ base=https://github.com/docker/machine/releases/download/v{{site.machine_version}} \
&& curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine \
&& sudo mv /tmp/docker-machine /usr/local/bin/docker-machine \
&& chmod +x /usr/local/bin/docker-machine
```
If you are running **Windows** with [Git BASH](https://git-for-windows.github.io/){: target="_blank" rel="noopener" class="_"}:
```console
$ base=https://github.com/docker/machine/releases/download/v{{site.machine_version}} &&
mkdir -p "$HOME/bin" &&
curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" &&
chmod +x "$HOME/bin/docker-machine.exe"
$ base=https://github.com/docker/machine/releases/download/v{{site.machine_version}} \
&& mkdir -p "$HOME/bin" \
&& curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" \
&& chmod +x "$HOME/bin/docker-machine.exe"
```
> The above command works on Windows only if you use a
@ -50,8 +50,10 @@ on GitHub.
3. Check the installation by displaying the Machine version:
$ docker-machine version
docker-machine version {{site.machine_version}}, build 9371605
```console
$ docker-machine version
docker-machine version {{site.machine_version}}, build 9371605
```
## Install bash completion scripts
@ -82,7 +84,7 @@ terminal to tell your setup where it can find the file
To enable the `docker-machine` shell prompt, add
`$(__docker_machine_ps1)` to your `PS1` setting in `~/.bashrc`.
```
```bash
PS1='[\u@\h \W$(__docker_machine_ps1)]\$ '
```
@ -111,13 +113,15 @@ To uninstall Docker Machine:
* Remove the executable: `rm $(which docker-machine)`
>**Note**: As a point of information, the `config.json`, certificates,
and other data related to each virtual machine created by `docker-machine`
is stored in `~/.docker/machine/machines/` on Mac and Linux and in
`~\.docker\machine\machines\` on Windows. We recommend that you do not edit or
remove those files directly as this only affects information for the Docker
CLI, not the actual VMs, regardless of whether they are local or on remote
servers.
> **Note**
>
> As a point of information, the `config.json`, certificates,
> and other data related to each virtual machine created by `docker-machine`
> is stored in `~/.docker/machine/machines/` on Mac and Linux and in
> `~\.docker\machine\machines\` on Windows. We recommend that you do not edit or
> remove those files directly as this only affects information for the Docker
> CLI, not the actual VMs, regardless of whether they are local or on remote
> servers.
## Where to go next

View File

@ -53,7 +53,7 @@ but here is a brief recap of the TUF roles and corresponding key hierarchy:
[hashes](https://en.wikipedia.org/wiki/Cryptographic_hash_function){:target="_blank" rel="noopener" class="_"}.
These files are used to verify the integrity of some or all of the actual contents of the repository.
They are also used to
[delegate trust to other collaborators via lower level [delegation roles](advanced_usage.md#work-with-delegation-roles).
delegate trust to other collaborators via lower level [delegation roles](advanced_usage.md#work-with-delegation-roles).
Delegation keys are held by anyone from the collection owner or administrator to
collection collaborators.

View File

@ -20,7 +20,7 @@ various APIs, CLIs, and file formats.
| CLI | Description |
|:---------------------------------------------------------------|:-------------------------------------------------------------------------------------------|
| [Docker CLI](/engine/reference/commandline/cli/) | The main CLI for Docker, includes all `docker` commands |
| [Compose CLI](/compose/reference/overview/) | The CLI for Docker Compose, which allows you to build and run multi-container applications |
| [Compose CLI](/compose/reference/) | The CLI for Docker Compose, which allows you to build and run multi-container applications |
| [Daemon CLI (dockerd)](/engine/reference/commandline/dockerd/) | Persistent process that manages containers |
@ -37,4 +37,4 @@ various APIs, CLIs, and file formats.
|:-------------------------------------------------------|:-----------------------------------------------------------------------------------|
| [Image specification](/registry/spec/manifest-v2-2/) | Describes the various components of a Docker image |
| [Registry token authentication](/registry/spec/auth/) | Outlines the Docker registry authentication scheme |
| [Registry storage drivers](/registry/storage-drivers/) | Enables support for given cloud providers when storing images with Registry |
| [Registry storage drivers](/registry/storage-drivers/) | Enables support for given cloud providers when storing images with Registry |

View File

@ -16,6 +16,10 @@ to the internet and fetches an image it doesn't have locally, from the Docker
repository. You can run a local registry mirror and point all your daemons
there, to avoid this extra internet traffic.
> **Note**
>
> Docker Official Images are an intellectual property of Docker. Distributing Docker Official Images to third parties 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=“”}.
### Alternatives
Alternatively, if the set of images you are using is well delimited, you can
@ -29,6 +33,10 @@ relying entirely on your local registry is the simplest scenario.
It's currently not possible to mirror another private registry. Only the central
Hub can be mirrored.
> **Note**
>
> Mirrors of Docker Hub are still subject to Docker's [fair usage policy](https://www.docker.com/pricing/resource-consumption-updates){: target="blank" rel="noopener" class=“”}.
### Solution
The Registry can be configured as a pull through cache. In this mode a Registry
@ -117,4 +125,4 @@ Save the file and reload Docker for the change to take effect.
> ```
>
> It's telling you that the file doesn't exist yet in the local cache and is
> being pulled from upstream.
> being pulled from upstream.

View File

@ -2,11 +2,13 @@
description: Installing and running an apt-cacher-ng service
keywords: docker, example, package installation, networking, debian, ubuntu
title: Dockerize an apt-cacher-ng service
redirect_from:
- /engine/examples/apt-cacher-ng/
---
> **Note**:
> - **If you don't like sudo** then see
> [*Giving non-root access*](../install/linux-postinstall.md#manage-docker-as-a-non-root-user).
> [*Giving non-root access*](../engine/install/linux-postinstall.md#manage-docker-as-a-non-root-user).
> - **If you're using macOS or docker via TCP** then you shouldn't use sudo.
When you have multiple Docker servers, or build unrelated Docker
@ -17,7 +19,8 @@ the second download of any package almost instant.
Use the following Dockerfile:
```dockerfile
#
# syntax=docker/dockerfile:1
# Build: docker build -t apt-cacher .
# Run: docker run -d -p 3142:3142 --name apt-cacher-run apt-cacher
#
@ -72,6 +75,7 @@ container.
a local version of a common base:
```dockerfile
# syntax=docker/dockerfile:1
FROM ubuntu
RUN echo 'Acquire::http { Proxy "http://dockerhost:3142"; };' >> /etc/apt/apt.conf.d/01proxy
RUN apt-get update && apt-get install -y vim git

View File

@ -2,6 +2,8 @@
description: Create a Docker Compose application using ASP.NET Core and SQL Server on Linux in Docker.
keywords: dotnet, .NET, Core, example, ASP.NET Core, SQL Server, mssql
title: "Quickstart: Compose and ASP.NET Core with SQL Server"
redirect_from:
- /compose/aspnet-mssql-compose/
---
This quick-start guide demonstrates how to use Docker Engine on Linux and Docker
@ -10,7 +12,7 @@ Compose to set up and run the sample ASP.NET Core application using the
with the
[SQL Server on Linux image](https://hub.docker.com/_/microsoft-mssql-server).
You just need to have [Docker Engine](../get-docker.md)
and [Docker Compose](install.md) installed on your
and [Docker Compose](../compose/install.md) installed on your
platform of choice: Linux, Mac or Windows.
For this sample, we create a sample .NET Core Web Application using the
@ -43,6 +45,7 @@ configure this app to use our SQL Server database, and then create a
1. Create a `Dockerfile` within your app directory and add the following content:
```dockerfile
# syntax=docker/dockerfile:1
FROM microsoft/dotnet:2.1-sdk
COPY . /app
WORKDIR /app
@ -201,3 +204,12 @@ to try out .NET Framework and more SQL Server tutorials.
- [SQL Server on Docker Hub](https://hub.docker.com/r/microsoft/mssql-server/)
- [ASP.NET Core](https://www.asp.net/core)
- [ASP.NET Core Docker image](https://hub.docker.com/r/microsoft/aspnetcore/) on DockerHub
## More Compose documentation
- [Docker Compose overview](../compose/index.md)
- [Install Docker Compose](../compose/install.md)
- [Getting Started with Docker Compose](../compose/gettingstarted.md)
- [Docker Compose Command line reference](../compose/reference/index.md)
- [Compose file reference](../compose/compose-file/index.md)
- [Awesome Compose samples](https://github.com/docker/awesome-compose/){:target="_blank" rel="noopener" class="_"}

View File

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

View File

@ -2,11 +2,13 @@
description: Sharing data between 2 couchdb databases
keywords: docker, example, package installation, networking, couchdb, data volumes
title: Dockerize a CouchDB service
redirect_from:
- /engine/examples/couchdb_data_volumes/
---
> **Note**
>
> **If you don't like sudo** then see [*Giving non-root access*](../install/linux-postinstall.md#manage-docker-as-a-non-root-user)
> **If you don't like sudo** then see [*Giving non-root access*](../engine/install/linux-postinstall.md#manage-docker-as-a-non-root-user)
Here's an example of using data volumes to share the same data between
two CouchDB containers. This could be used for hot upgrades, testing

View File

@ -2,10 +2,12 @@
description: Getting started with Docker Compose and Django
keywords: documentation, docs, docker, compose, orchestration, containers
title: "Quickstart: Compose and Django"
redirect_from:
- /compose/django/
---
This quick-start guide demonstrates how to use Docker Compose to set up and run a simple Django/PostgreSQL app. Before starting,
[install Compose](install.md).
[install Compose](../compose/install.md).
### Define the project components
@ -26,6 +28,7 @@ and a `docker-compose.yml` file. (You can use either a `.yml` or `.yaml` extensi
3. Add the following content to the `Dockerfile`.
```dockerfile
# syntax=docker/dockerfile:1
FROM python:3
ENV PYTHONUNBUFFERED=1
WORKDIR /code
@ -58,7 +61,7 @@ and a `docker-compose.yml` file. (You can use either a `.yml` or `.yaml` extensi
also describes which Docker images these services use, how they link
together, any volumes they might need to be mounted inside the containers.
Finally, the `docker-compose.yml` file describes which ports these services
expose. See the [`docker-compose.yml` reference](compose-file/index.md) for more
expose. See the [`docker-compose.yml` reference](../compose/compose-file/index.md) for more
information on how this file works.
9. Add the following configuration to the file.
@ -102,7 +105,7 @@ In this step, you create a Django starter project by building the image from the
1. Change to the root of your project directory.
2. Create the Django project by running the [docker-compose run](reference/run.md)
2. Create the Django project by running the [docker-compose run](../compose/reference/run.md)
command as follows.
```console
@ -184,7 +187,7 @@ In this section, you set up the database connection for Django.
3. Save and close the file.
4. Run the [docker-compose up](reference/up.md) command from the top level directory for your project.
4. Run the [docker-compose up](../compose/reference/up.md) command from the top level directory for your project.
```console
$ docker-compose up
@ -252,7 +255,7 @@ In this section, you set up the database connection for Django.
```
* Or, for a more elegant shutdown, switch to a different shell, and run
[docker-compose down](reference/down.md) from the top level of your
[docker-compose down](../compose/reference/down.md) from the top level of your
Django sample project directory.
```console
@ -270,9 +273,9 @@ In this section, you set up the database connection for Django.
## More Compose documentation
- [User guide](index.md)
- [Installing Compose](install.md)
- [Getting Started](gettingstarted.md)
- [Command line reference](reference/index.md)
- [Compose file reference](compose-file/index.md)
- [Sample apps with Compose](samples-for-compose.md)
- [Docker Compose overview](../compose/index.md)
- [Install Docker Compose](../compose/install.md)
- [Getting Started with Docker Compose](../compose/gettingstarted.md)
- [Docker Compose Command line reference](../compose/reference/index.md)
- [Compose file reference](../compose/compose-file/index.md)
- [Awesome Compose samples](https://github.com/docker/awesome-compose/){:target="_blank" rel="noopener" class="_"}

View File

@ -2,6 +2,8 @@
description: Create a Docker image by layering your ASP.NET Core app on debian for Linux Containers or with Windows Nano Server containers using a Dockerfile.
keywords: dockerize, dockerizing, dotnet, .NET, Core, article, example, platform, installation, containers, images, image, dockerfile, build, asp.net, asp.net core
title: Dockerize an ASP.NET Core application
redirect_from:
- /engine/examples/dotnetcore/
---
## Introduction
@ -15,9 +17,8 @@ This example demonstrates how to dockerize an ASP.NET Core application.
Linux
- Great for modern cloud-based apps, such as web apps, IoT apps, and mobile
backends
- ASP.NET Core apps can run on [.NET
Core](https://www.microsoft.com/net/core/platform) or on the full [.NET
Framework](https://www.microsoft.com/net/framework)
- ASP.NET Core apps can run on [.NET Core](https://www.microsoft.com/net/core/platform)
or on the full [.NET Framework](https://www.microsoft.com/net/framework)
- Designed to provide an optimized development framework for apps that are
deployed to the cloud or run on-premises
- Modular components with minimal overhead retain flexibility while
@ -26,24 +27,26 @@ constructing your solutions
## Prerequisites
This example assumes you already have an ASP.NET Core app
on your machine. If you are new to ASP.NET you can follow a [simple
tutorial](https://www.asp.net/get-started) to initialize a project or clone our [ASP.NET Docker Sample](https://github.com/dotnet/dotnet-docker/tree/master/samples/aspnetapp).
on your machine. If you are new to ASP.NET you can follow a
[simple tutorial](https://www.asp.net/get-started) to initialize a project or
clone our [ASP.NET Docker Sample](https://github.com/dotnet/dotnet-docker/tree/master/samples/aspnetapp).
## Create a Dockerfile for an ASP.NET Core application
### Method 1:
1. Create a `Dockerfile` in your project folder.
2. Add the text below to your `Dockerfile` for either Linux or [Windows
Containers](https://docs.microsoft.com/virtualization/windowscontainers/about/).
2. Add the text below to your `Dockerfile` for either Linux or
[Windows Containers](https://docs.microsoft.com/virtualization/windowscontainers/about/).
The tags below are multi-arch meaning they pull either Windows or
Linux containers depending on what mode is set in
[Docker Desktop for Windows](../../docker-for-windows/index.md). Read more on
[switching containers](../../docker-for-windows/index.md#switch-between-windows-and-linux-containers).
[Docker Desktop for Windows](../docker-for-windows/index.md). Read more on
[switching containers](../docker-for-windows/index.md#switch-between-windows-and-linux-containers).
3. The `Dockerfile` assumes that your application is called `aspnetapp`. Change
the `Dockerfile` to use the DLL file of your project.
```dockerfile
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
WORKDIR /app
@ -52,7 +55,7 @@ COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
COPY ../engine/examples ./
RUN dotnet publish -c Release -o out
# Build runtime image
@ -73,12 +76,12 @@ obj/
### Method 2 (build app outside Docker container):
1. Create a `Dockerfile` in your project folder.
2. Add the text below to your `Dockerfile` for either Linux or [Windows
Containers](https://docs.microsoft.com/virtualization/windowscontainers/about/).
2. Add the text below to your `Dockerfile` for either Linux or
[Windows Containers](https://docs.microsoft.com/virtualization/windowscontainers/about/).
The tags below are multi-arch meaning they pull either Windows or
Linux containers depending on what mode is set in
[Docker Desktop for Windows](../../docker-for-windows/index.md). Read more on
[switching containers](../../docker-for-windows/index.md#switch-between-windows-and-linux-containers).
[Docker Desktop for Windows](../docker-for-windows/index.md). Read more on
[switching containers](../docker-for-windows/index.md#switch-between-windows-and-linux-containers).
3. The `Dockerfile` assumes that your application is called `aspnetapp`. Change the `Dockerfile` to use the DLL file of your project. This method assumes that your project is already built and it copies the build artifacts from the publish folder. Refer to the Microsoft documentation on [Containerize a .Net Core app](https://docs.microsoft.com/en-us/dotnet/core/docker/build-container?tabs=windows#create-the-dockerfile){: target="blank" rel="noopener" class=“"}.
The `docker build` step here will be much faster than method 1, as all the artifacts are built outside of the `docker build` step and the size of the base image is much smaller compared to the build base image.
@ -86,6 +89,7 @@ obj/
This method is preferred for CI tools like Jenkins, Azure DevOps, GitLab CI, etc. as you can use the same artifacts in multiple deployment models if Docker isn't the only deployment model being used. Additionally, you'll be able to run unit tests and publish code coverage reports, or use custom plugins on the artifacts built by the CI.
```dockerfile
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/aspnet:5.0
COPY bin/Release/netcoreapp3.1/publish/ App/
WORKDIR /App
@ -109,7 +113,7 @@ $ docker run -d -p 8080:80 --name myapp aspnetapp
## View the web page running from a container
* Go to [localhost:8080](http://localhost:8080) to access your app in a web browser.
* If you are using the Nano [Windows Container](../../docker-for-windows/index.md)
* If you are using the Nano [Windows Container](../docker-for-windows/index.md)
and have not updated to the Windows Creator Update there is a bug affecting how
[Windows 10 talks to Containers via "NAT"](https://github.com/Microsoft/Virtualization-Documentation/issues/181#issuecomment-252671828)
(Network Address Translation). You must hit the IP of the container

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 334 KiB

After

Width:  |  Height:  |  Size: 334 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -1,6 +1,10 @@
---
title: Samples
description: Learn how to develop and ship containerized applications, by walking through samples that exhibits canonical practices.
redirect_from:
- /en/latest/examples/
- /engine/examples/
- /examples/
---
{% assign labsbase = "https://github.com/docker/labs/tree/master" %}
@ -11,41 +15,37 @@ Learn how to develop and ship containerized applications, by walking through a
sample that exhibits canonical practices. These labs are from the [Docker Labs
repository]({{ labsbase }}).
| Sample | Description |
| ------ | ----------- |
| [Docker for Beginners]({{ labsbase }}/beginner/){: target="_blank"} | A good "Docker 101" course. |
| [Docker Swarm mode]({{ labsbase}}/swarm-mode){: target="_blank"} | Use Docker for natively managing a cluster of Docker Engines called a swarm. |
| [Configuring developer tools and programming languages]({{ labsbase }}/developer-tools/README.md){: target="_blank"} | How to set-up and use common developer tools and programming languages with Docker. |
| [Live Debugging Java with Docker]({{ labsbase }}/developer-tools/java-debugging){: target="_blank"} | Java developers can use Docker to build a development environment where they can run, test, and live debug code running within a container. |
| [Docker for Java Developers]({{ labsbase }}/developer-tools/java/){: target="_blank"} | Offers Java developers an intro-level and self-paced hands-on workshop with Docker. |
| [Live Debugging a Node.js application in Docker]({{ labsbase }}/developer-tools/nodejs-debugging){: target="_blank"} | Node developers can use Docker to build a development environment where they can run, test, and live debug code running within a container. |
| [Dockerizing a Node.js application]({{ labsbase }}/developer-tools/nodejs/porting/){: target="_blank"} | This tutorial starts with a simple Node.js application and details the steps needed to Dockerize it and ensure its scalability. |
| [Docker for ASP.NET and Windows containers]({{ labsbase }}/windows/readme.md){: target="_blank"} | Docker supports Windows containers, too! Learn how to run ASP.NET, SQL Server, and more in these tutorials. |
| [Docker Security]({{ labsbase }}/security/README.md){: target="_blank"} | How to take advantage of Docker security features. |
| [Building a 12-factor application with Docker]({{ labsbase}}/12factor){: target="_blank"} | Use Docker to create an app that conforms to Heroku's "12 factors for cloud-native applications." |
| Sample | Description |
| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| [Docker for Beginners]({{ labsbase }}/beginner/){: target="_blank"} | A good "Docker 101" course. |
| [Docker Swarm mode]({{ labsbase}}/swarm-mode){: target="_blank"} | Use Docker for natively managing a cluster of Docker Engines called a swarm. |
| [Configuring developer tools and programming languages]({{ labsbase }}/developer-tools/README.md){: target="_blank"} | How to set-up and use common developer tools and programming languages with Docker. |
| [Live Debugging Java with Docker]({{ labsbase }}/developer-tools/java-debugging){: target="_blank"} | Java developers can use Docker to build a development environment where they can run, test, and live debug code running within a container. |
| [Docker for Java Developers]({{ labsbase }}/developer-tools/java/){: target="_blank"} | Offers Java developers an intro-level and self-paced hands-on workshop with Docker. |
| [Live Debugging a Node.js application in Docker]({{ labsbase }}/developer-tools/nodejs-debugging){: target="_blank"} | Node developers can use Docker to build a development environment where they can run, test, and live debug code running within a container. |
| [Dockerizing a Node.js application]({{ labsbase }}/developer-tools/nodejs/porting/){: target="_blank"} | This tutorial starts with a simple Node.js application and details the steps needed to Dockerize it and ensure its scalability. |
| [Docker for ASP.NET and Windows containers]({{ labsbase }}/windows/readme.md){: target="_blank"} | Docker supports Windows containers, too! Learn how to run ASP.NET, SQL Server, and more in these tutorials. |
| [Docker Security]({{ labsbase }}/security/README.md){: target="_blank"} | How to take advantage of Docker security features. |
| [Building a 12-factor application with Docker]({{ labsbase}}/12factor){: target="_blank"} | Use Docker to create an app that conforms to Heroku's "12 factors for cloud-native applications." |
## Sample applications
Run popular software using Docker.
| Sample | Description |
| ------------------------------------------------------------------------- | --------------------------------------------------------- |
| [apt-cacher-ng](../engine/examples/apt-cacher-ng.md) | Run a Dockerized apt-cacher-ng instance. |
| [.Net Core application](../engine/examples/dotnetcore.md) | Run a Dockerized ASP.NET Core application. |
| [ASP.NET Core + SQL Server on Linux](../compose/aspnet-mssql-compose.md) | Run a Dockerized ASP.NET Core + SQL Server environment. |
| [CouchDB](../engine/examples/couchdb_data_volumes.md) | Run a Dockerized CouchDB instance. |
| [Django + PostgreSQL](../compose/django.md) | Run a Dockerized Django + PostgreSQL environment. |
| [PostgreSQL](../engine/examples/postgresql_service.md) | Run a Dockerized PostgreSQL instance. |
| [Rails + PostgreSQL](../compose/rails.md) | Run a Dockerized Rails + PostgreSQL environment. |
| [Riak](../engine/examples/running_riak_service.md) | Run a Dockerized Riak instance. |
| [SSHd](../engine/examples/running_ssh_service.md) | Run a Dockerized SSHd instance. |
| [WordPress](../compose/wordpress.md) | Quickstart: Compose and WordPress. |
| Sample | Description |
| --------------------------------------------------------------| --------------------------------------------------------- |
| [apt-cacher-ng](apt-cacher-ng.md) | Run a Dockerized apt-cacher-ng instance. |
| [.Net Core application](dotnetcore.md) | Run a Dockerized ASP.NET Core application. |
| [ASP.NET Core + SQL Server on Linux](aspnet-mssql-compose.md) | Run a Dockerized ASP.NET Core + SQL Server environment. |
| [CouchDB](couchdb_data_volumes.md) | Run a Dockerized CouchDB instance. |
| [Django + PostgreSQL](django.md) | Run a Dockerized Django + PostgreSQL environment. |
| [PostgreSQL](postgresql_service.md) | Run a Dockerized PostgreSQL instance. |
| [Rails + PostgreSQL](rails.md) | Run a Dockerized Rails + PostgreSQL environment. |
| [Riak](running_riak_service.md) | Run a Dockerized Riak instance. |
| [SSHd](running_ssh_service.md) | Run a Dockerized SSHd instance. |
| [WordPress](wordpress.md) | Quickstart: Compose and WordPress. |
## Library references
## Samples and documentation for official Docker images {#library-references}
The following table provides a list of popular official Docker images. For detailed documentation, select the specific image name.
| Image name | Description |
| ---------- | ----------- |
{% for page in site.samples %}| [{{ page.title }}](https://hub.docker.com/_/{{ page.title }}){: target="_blank"} | {{ page.description | strip }} |
{% endfor %}
For samples and detailed information about [official Docker images](../docker-hub/official_images.md),
refer to the documentation [for each image on Docker Hub](https://hub.docker.com/search?q=&type=image&image_filter=official){: target="_blank"}.

View File

@ -2,6 +2,8 @@
description: Running and installing a PostgreSQL service
keywords: docker, example, package installation, postgresql
title: Dockerize PostgreSQL
redirect_from:
- /engine/examples/postgresql_service/
---
## Install PostgreSQL on Docker
@ -17,10 +19,7 @@ PostgreSQL documentation to fine-tune these settings so that it is
suitably secure.
```dockerfile
#
# example Dockerfile for https://docs.docker.com/engine/examples/postgresql_service/
#
# syntax=docker/dockerfile:1
FROM ubuntu:16.04
# Add the PostgreSQL PGP key to verify their Debian packages.
@ -80,7 +79,7 @@ $ docker run --rm -P --name pg_test eg_postgresql
```
There are two ways to connect to the PostgreSQL server. We can use
[*Link Containers*](../../network/links.md),
[*Link Containers*](../network/links.md),
or we can access it from our host (or the network).
> **Note**: The `--rm` removes the container and its image when

View File

@ -2,10 +2,12 @@
description: Getting started with Docker Compose and Rails
keywords: documentation, docs, docker, compose, orchestration, containers
title: "Quickstart: Compose and Rails"
redirect_from:
- /compose/rails/
---
This Quickstart guide shows you how to use Docker Compose to set up and run
a Rails/PostgreSQL app. Before starting, [install Compose](install.md).
a Rails/PostgreSQL app. Before starting, [install Compose](../compose/install.md).
### Define the project
@ -15,13 +17,14 @@ Docker container containing its dependencies. Defining dependencies is done usin
a file called `Dockerfile`. To begin with, the Dockerfile consists of:
```dockerfile
# syntax=docker/dockerfile:1
FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
WORKDIR /myapp
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
COPY . /myapp
COPY ../compose /myapp
# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
@ -229,7 +232,7 @@ browser to see the Rails Welcome.
### Stop the application
To stop the application, run [docker-compose down](reference/down.md) in
To stop the application, run [docker-compose down](../compose/reference/down.md) in
your project directory. You can use the same terminal window in which you
started the database, or another one where you have access to a command prompt.
This is a clean way to stop the application.
@ -277,9 +280,9 @@ host.
## More Compose documentation
- [User guide](index.md)
- [Installing Compose](install.md)
- [Getting Started](gettingstarted.md)
- [Command line reference](reference/index.md)
- [Compose file reference](compose-file/index.md)
- [Sample apps with Compose](samples-for-compose.md)
- [Docker Compose overview](../compose/index.md)
- [Install Docker Compose](../compose/install.md)
- [Getting Started with Docker Compose](../compose/gettingstarted.md)
- [Docker Compose Command line reference](../compose/reference/index.md)
- [Compose file reference](../compose/compose-file/index.md)
- [Awesome Compose samples](https://github.com/docker/awesome-compose/){:target="_blank" rel="noopener" class="_"}

View File

@ -2,6 +2,8 @@
description: Build a Docker image with Riak pre-installed
keywords: docker, example, package installation, networking, riak
title: Dockerize a Riak service
redirect_from:
- /engine/examples/running_riak_service/
---
The goal of this example is to show you how to build a Docker image with
@ -20,6 +22,7 @@ of. We use [Ubuntu](https://hub.docker.com/_/ubuntu/) (tag:
`trusty`), which is available on [Docker Hub](https://hub.docker.com):
```dockerfile
# syntax=docker/dockerfile:1
# Riak
#
# VERSION 0.1.1

View File

@ -2,6 +2,8 @@
description: Installing and running an SSHd service on Docker
keywords: docker, example, package installation, networking
title: Dockerize an SSH service
redirect_from:
- /engine/examples/running_ssh_service/
---
Running sshd inside a container is discouraged, however, it might be still useful

View File

@ -2,12 +2,14 @@
description: Getting started with Compose and WordPress
keywords: documentation, docs, docker, compose, orchestration, containers
title: "Quickstart: Compose and WordPress"
redirect_from:
- /compose/wordpress/
---
You can use Docker Compose to easily run WordPress in an isolated environment
built with Docker containers. This quick-start guide demonstrates how to use
Compose to set up and run WordPress. Before starting, make sure you have
[Compose installed](install.md).
[Compose installed](../compose/install.md).
### Define the project
@ -78,7 +80,7 @@ Compose to set up and run WordPress. Before starting, make sure you have
Now, run `docker-compose up -d` from your project directory.
This runs [`docker-compose up`](reference/up.md) in detached mode, pulls
This runs [`docker-compose up`](../compose/reference/up.md) in detached mode, pulls
the needed Docker images, and starts the wordpress and database containers, as shown in
the example below.
@ -134,7 +136,7 @@ browser.
### Shutdown and cleanup
The command [`docker-compose down`](reference/down.md) removes the
The command [`docker-compose down`](../compose/reference/down.md) removes the
containers and default network, but preserves your WordPress database.
The command `docker-compose down --volumes` removes the containers, default
@ -142,9 +144,9 @@ network, and the WordPress database.
## More Compose documentation
- [User guide](index.md)
- [Installing Compose](install.md)
- [Getting Started](gettingstarted.md)
- [Command line reference](reference/index.md)
- [Compose file reference](compose-file/index.md)
- [Sample apps with Compose](samples-for-compose.md)
- [Docker Compose overview](../compose/index.md)
- [Install Docker Compose](../compose/install.md)
- [Getting Started with Docker Compose](../compose/gettingstarted.md)
- [Docker Compose Command line reference](../compose/reference/index.md)
- [Compose file reference](../compose/compose-file/index.md)
- [Awesome Compose samples](https://github.com/docker/awesome-compose/){:target="_blank" rel="noopener" class="_"}

View File

@ -30,6 +30,7 @@ instruction in the image's Dockerfile. Each layer except the very last one is
read-only. Consider the following Dockerfile:
```dockerfile
# syntax=docker/dockerfile:1
FROM ubuntu:18.04
COPY . /app
RUN make /app
@ -164,6 +165,7 @@ Now imagine that you have two different Dockerfiles. You use the first one to
create an image called `acme/my-base-image:1.0`.
```dockerfile
# syntax=docker/dockerfile:1
FROM ubuntu:18.04
COPY . /app
```
@ -172,6 +174,7 @@ The second one is based on `acme/my-base-image:1.0`, but has some additional
layers:
```dockerfile
# syntax=docker/dockerfile:1
FROM acme/my-base-image:1.0
CMD /app/hello.sh
```
@ -210,7 +213,7 @@ layers are the same.
include the final `.` in the command. That sets the `PATH`, which tells
Docker where to look for any files that need to be added to the image.
```bash
```console
$ docker build -t acme/my-base-image:1.0 -f Dockerfile.base .
Sending build context to Docker daemon 812.4MB
Step 1/2 : FROM ubuntu:18.04
@ -224,7 +227,7 @@ layers are the same.
6. Build the second image.
```bash
```console
$ docker build -t acme/my-final-image:1.0 -f Dockerfile .
Sending build context to Docker daemon 4.096kB
@ -240,7 +243,7 @@ layers are the same.
7. Check out the sizes of the images:
```bash
```console
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
@ -250,7 +253,7 @@ layers are the same.
8. Check out the layers that comprise each image:
```bash
```console
$ docker history bd09118bcef6
IMAGE CREATED CREATED BY SIZE COMMENT
bd09118bcef6 4 minutes ago /bin/sh -c #(nop) COPY dir:35a7eb158c1504e... 100B
@ -262,7 +265,7 @@ layers are the same.
<missing> 3 months ago /bin/sh -c #(nop) ADD file:eef57983bd66e3a... 103MB
```
```bash
```console
$ docker history dbf995fc07ff
IMAGE CREATED CREATED BY SIZE COMMENT

View File

@ -779,7 +779,9 @@ command=/usr/sbin/sshd -D
To enable syntax highlighting for Dockerfiles, use the `conf` lexer, for now.
In the future, native Dockerfile support is coming to Rouge.
```conf
```dockerfile
# syntax=docker/dockerfile:1
#
# example Dockerfile for https://docs.docker.com/examples/postgresql_service/
#