diff --git a/language/golang/build-images.md b/language/golang/build-images.md index d81b8ab2d9..d9a96d4851 100644 --- a/language/golang/build-images.md +++ b/language/golang/build-images.md @@ -241,7 +241,7 @@ image is used to start a container. We do this with the `CMD` command: ```dockerfile -CMD [ "/docker-gs-ping" ] +CMD ["/docker-gs-ping"] ``` Here's the complete `Dockerfile`: @@ -273,7 +273,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /docker-gs-ping EXPOSE 8080 # Run -CMD [ "/docker-gs-ping" ] +CMD ["/docker-gs-ping"] ``` The `Dockerfile` may also contain _comments_. They always begin with a `#` symbol, diff --git a/language/nodejs/build-images.md b/language/nodejs/build-images.md index 6fd5e30715..49a650c195 100644 --- a/language/nodejs/build-images.md +++ b/language/nodejs/build-images.md @@ -158,7 +158,7 @@ COPY . . The COPY command takes all the files located in the current directory and copies them into the image. Now, all we have to do is to tell Docker what command we want to run when our image is run inside of a container. We do this with the `CMD` command. ```dockerfile -CMD [ "node", "server.js" ] +CMD ["node", "server.js"] ``` Here's the complete Dockerfile. @@ -177,7 +177,7 @@ RUN npm install --production COPY . . -CMD [ "node", "server.js" ] +CMD ["node", "server.js"] ``` ## Create a .dockerignore file diff --git a/language/nodejs/run-tests.md b/language/nodejs/run-tests.md index 7fe3c84aac..2489c11409 100644 --- a/language/nodejs/run-tests.md +++ b/language/nodejs/run-tests.md @@ -119,12 +119,12 @@ COPY package-lock.json package-lock.json FROM base as test RUN npm ci COPY . . -CMD [ "npm", "run", "test" ] +CMD ["npm", "run", "test"] FROM base as prod RUN npm ci --production COPY . . -CMD [ "node", "server.js" ] +CMD ["node", "server.js"] ``` We first add a label `as base` to the `FROM node:18-alpine` statement. This allows us to refer to this build stage in other build stages. Next we add a new build stage labeled test. We will use this stage for running our tests. @@ -189,7 +189,7 @@ RUN npm run test FROM base as prod RUN npm ci --production COPY . . -CMD [ "node", "server.js" ] +CMD ["node", "server.js"] ``` Now to run our tests, we just need to run the docker build command as above. diff --git a/language/python/build-images.md b/language/python/build-images.md index be5dcf34fd..fee53c5603 100644 --- a/language/python/build-images.md +++ b/language/python/build-images.md @@ -116,7 +116,7 @@ COPY . . Now, tell Docker what command to run when the image is executed inside a container using the `CMD` command. Note that you need to make the application externally visible (i.e. from outside the container) by specifying `--host=0.0.0.0`. ```dockerfile -CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"] +CMD ["python3", "-m" , "flask", "run", "--host=0.0.0.0"] ``` Here's the complete Dockerfile. @@ -133,7 +133,7 @@ RUN pip3 install -r requirements.txt COPY . . -CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"] +CMD ["python3", "-m" , "flask", "run", "--host=0.0.0.0"] ``` ### Directory structure @@ -170,7 +170,7 @@ $ docker build --tag python-docker . => [3/6] COPY requirements.txt requirements.txt => [4/6] RUN pip3 install -r requirements.txt => [5/6] COPY . . - => [6/6] CMD [ "python3", "-m", "flask", "run", "--host=0.0.0.0"] + => [6/6] CMD ["python3", "-m", "flask", "run", "--host=0.0.0.0"] => exporting to image => => exporting layers => => writing image sha256:8cae92a8fbd6d091ce687b71b31252056944b09760438905b726625831564c4c