From 6b3376ca129a0d0d0a2d96ad7f56b2f5b0cbf83d Mon Sep 17 00:00:00 2001 From: Jorge Henrique Date: Sat, 17 Feb 2018 00:10:39 -0300 Subject: [PATCH 1/4] Added bests pratices and util cmds for dockerfile --- dockerfile.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dockerfile.md b/dockerfile.md index 6c58b9494..8a2a8b57d 100644 --- a/dockerfile.md +++ b/dockerfile.md @@ -30,6 +30,16 @@ RUN bundle install WORKDIR /myapp ``` +``` +VOLUME ["/data"] +# Specification for mount point +``` + +```docker +ADD file.xyz /file.xyz +COPY --chown=user:group host_file.xyz /path/container_file.xyz +``` + ### Onbuild ```bash @@ -44,6 +54,30 @@ EXPOSE 5900 CMD ["bundle", "exec", "rails", "server"] ``` +### Entrypoint + +```docker +ENTRYPOINT ["executable", "param1", "param2"] +ENTRYPOINT command param1 param2 +# an ENTRYPOINT allows you to configure a container that will run as an executable. +``` + +```docker +ENTRYPOINT exec top -b +# this form will use shell processing to substitute shell environment variables, and will ignore any CMD or docker run command line arguments +``` + +### Metadata + +```docker +LABEL "com.example.vendor"="ACME Incorporated" +LABEL com.example.label-with-value="foo" +LABEL version="1.0" +LABEL description="This text illustrates \ +that label-values can span multiple lines." +# add a metada +``` + ## See also {: .-one-column} From 2d06aff7cf04d10ec1bebd37de66ca614f23eab2 Mon Sep 17 00:00:00 2001 From: Jorge Henrique Date: Sat, 17 Feb 2018 00:16:11 -0300 Subject: [PATCH 2/4] Added build from dockerfile using docker-compose --- docker-compose.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose.md b/docker-compose.md index 1b94175bb..164c9987e 100644 --- a/docker-compose.md +++ b/docker-compose.md @@ -16,6 +16,9 @@ version: '2' services: web: build: . + # build from Dockerfile + context: ./Path + dockerfile: Dockerfile ports: - "5000:5000" volumes: From eceeeadb12670db31a37a60b654cfe41173c5a49 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Sat, 17 Mar 2018 13:28:27 +0800 Subject: [PATCH 3/4] docker-compose: fix indentation --- docker-compose.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.md b/docker-compose.md index 164c9987e..00fc2c64f 100644 --- a/docker-compose.md +++ b/docker-compose.md @@ -16,9 +16,9 @@ version: '2' services: web: build: . - # build from Dockerfile - context: ./Path - dockerfile: Dockerfile + # build from Dockerfile + context: ./Path + dockerfile: Dockerfile ports: - "5000:5000" volumes: From f1c0667e6d579f68b1cc104e2b57d5f87cf87e4e Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Sat, 17 Mar 2018 13:30:02 +0800 Subject: [PATCH 4/4] docker-compose: update formatting --- dockerfile.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dockerfile.md b/dockerfile.md index 8a2a8b57d..8ed25b663 100644 --- a/dockerfile.md +++ b/dockerfile.md @@ -59,23 +59,30 @@ CMD ["bundle", "exec", "rails", "server"] ```docker ENTRYPOINT ["executable", "param1", "param2"] ENTRYPOINT command param1 param2 -# an ENTRYPOINT allows you to configure a container that will run as an executable. ``` +Configures a container that will run as an executable. + ```docker ENTRYPOINT exec top -b -# this form will use shell processing to substitute shell environment variables, and will ignore any CMD or docker run command line arguments ``` +This will use shell processing to substitute shell variables, and will ignore any `CMD` or `docker run` command line arguments. + ### Metadata +```docker +LABEL version="1.0" +``` + ```docker LABEL "com.example.vendor"="ACME Incorporated" LABEL com.example.label-with-value="foo" -LABEL version="1.0" +```docker + +```docker LABEL description="This text illustrates \ that label-values can span multiple lines." -# add a metada ``` ## See also