Skip to content

Commit

Permalink
docker-compose -> docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
flemay committed Sep 1, 2024
1 parent 32bc7ed commit ee14ba0
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 31 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
COMPOSE_PULL = docker-compose pull
COMPOSE_RUN_NODE = docker-compose run --rm node
COMPOSE_UP_NODE = docker-compose up -d node
COMPOSE_UP_NODE_DEV = docker-compose up node_dev
COMPOSE_PULL = docker compose pull
COMPOSE_RUN_NODE = docker compose run --rm node
COMPOSE_UP_NODE = docker compose up -d node
COMPOSE_UP_NODE_DEV = docker compose up node_dev
ENVFILE ?= env.template
SERVE_BASE_URL ?= http://node:5173

Expand Down Expand Up @@ -73,7 +73,7 @@ _deploy:
--commit-message="Deploy!"

pruneDocker:
docker-compose down --remove-orphans --volumes
docker compose down --remove-orphans --volumes

prune:
$(COMPOSE_RUN_NODE) bash -c "rm -fr docs/.vitepress/dist docs/.vitepress/.cache"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Let's print out `Hello, World!` in the terminal using the 3 Musketeers. The comm
Create the following 2 files:

```yaml
# docker-compose.yml
# compose.yml
services:
alpine:
image: alpine
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions diagrams/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
COMPOSE_PULL = docker compose pull
COMPOSE_RUN_MERMAID_SH = docker-compose run --rm --entrypoint sh mermaid
COMPOSE_RUN_MERMAID_SH = docker compose run --rm --entrypoint sh mermaid

all: deps mermaid prune

Expand All @@ -13,4 +13,4 @@ shell:
$(COMPOSE_RUN_MERMAID_SH)

prune:
docker-compose down --remove-orphans --volumes
docker compose down --remove-orphans --volumes
2 changes: 1 addition & 1 deletion docs/guide/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Mounting volumes with Docker on Mac or Windows can be slow. For instance, develo
On Mac, using the `native_osx` strategy can also help. The Docker Compose file would look like the following:

```yaml
# docker-compose.yml
# compose.yml
yourservice:
image: animage
volumes:
Expand Down
24 changes: 12 additions & 12 deletions docs/guide/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ ENV_B=
ENV_C=env_c
```

And the file `docker-compose.yml`:
And the file `compose.yml`:

```yaml
# docker-compose.yml
# compose.yml
services:
alpine:
image: alpine
Expand Down Expand Up @@ -118,7 +118,7 @@ ENV_VAR_B=b
- env.template
- env.example
- makefile
- docker-compose.yml
- compose.yml
- application source code
- pipeline-as-code file
- Error prone
Expand Down Expand Up @@ -160,10 +160,10 @@ And the file `env.example`:
ENV_MY_VAR=MY_VALUE
```

And the file `docker-compose.yml`:
And the file `compose.yml`:

```yaml
# docker-compose.yml
# compose.yml
version: "3.8"
services:
alpine:
Expand All @@ -177,7 +177,7 @@ services:
```
::: info
The `docker-compose.yml` above has the [variable substitution][linkDockerComposeVarialeSubstitution] `env_file: ${ENVFILE:-.env}`, which allows the use of a different file that `.env` by defining the environment variable `ENVFILE`. This was required for using Compose otherwise Compose would simply fail. Examples in this section will use `.env` except when generating the file.
The `compose.yml` above has the [variable substitution][linkDockerComposeVarialeSubstitution] `env_file: ${ENVFILE:-.env}`, which allows the use of a different file that `.env` by defining the environment variable `ENVFILE`. This was required for using Compose otherwise Compose would simply fail. Examples in this section will use `.env` except when generating the file.
:::

#### Explicit
Expand All @@ -190,7 +190,7 @@ Explicit is the method I prefer the most.

```make
# Makefile
COMPOSE_RUN_ALPINE = docker-compose run alpine
COMPOSE_RUN_ALPINE = docker compose run alpine
ENVFILE ?= env.template
envfile:
Expand Down Expand Up @@ -225,7 +225,7 @@ Targets requiring `.env` file will get it created if it does not exist. The `.en

```make
# Makefile
COMPOSE_RUN_ALPINE = docker-compose run alpine
COMPOSE_RUN_ALPINE = docker compose run alpine
ENVFILE ?= env.template

.env:
Expand Down Expand Up @@ -262,7 +262,7 @@ Targets requiring `.env` file will get it created if it does not exist. The `.en

```makefile
# Makefile
COMPOSE_RUN_ALPINE = docker-compose run alpine
COMPOSE_RUN_ALPINE = docker compose run alpine
ifdef ENVFILE
ENVFILE_TARGET=envfile
else
Expand Down Expand Up @@ -299,7 +299,7 @@ make target ENVFILE=env.example

### With Make and Docker

Everything covered in section [With Make and Compose][linkSectionWithMakeAndCompose] can be applied here except Docker won't use `docker-compose.yml`. Here's an example with the explicit method:
Everything covered in section [With Make and Compose][linkSectionWithMakeAndCompose] can be applied here except Docker won't use `compose.yml`. Here's an example with the explicit method:

```makefile
# Makefile
Expand Down Expand Up @@ -446,7 +446,7 @@ ENV_MESSAGE="Hello, World!"
```

```yml
# docker-compose.yml
# compose.yml
version: '3.8'
services:
alpine:
Expand All @@ -461,7 +461,7 @@ services:
```makefile
# Makefile
COMPOSE_RUN_ALPINE = docker-compose run alpine
COMPOSE_RUN_ALPINE = docker compose run alpine
ENVFILE ?= env.template

envfile:
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Let's print out `Hello, World!` in the terminal using the 3 Musketeers. The comm
Create the following 2 files:

```yaml
# docker-compose.yml
# compose.yml
services:
alpine:
image: alpine
Expand Down
12 changes: 6 additions & 6 deletions docs/guide/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ There are [ways][linkDocker] to add Make to your Docker image if it does not hav
:::

```yaml
# docker-compose.yml
# compose.yml
version: '3'
services:
alpine:
Expand Down Expand Up @@ -67,7 +67,7 @@ make echo
Make calls Compose which executes a shell/bash command inside a Docker container.

```yaml
# docker-compose.yml
# compose.yml
version: '3'
services:
alpine:
Expand Down Expand Up @@ -122,7 +122,7 @@ chmod +x make.sh
```

```yaml
# docker-compose.yml
# compose.yml
version: '3.8'
services:
alpine:
Expand Down Expand Up @@ -158,7 +158,7 @@ func main() {
```

```yaml
# docker-compose.yml
# compose.yml
version: '3'
services:
golang:
Expand Down Expand Up @@ -194,7 +194,7 @@ There are many languages and tools out there to make task implementation easy su
```

```yaml
# docker-compose.yml
# compose.yml
version: '3'
services:
node:
Expand All @@ -207,7 +207,7 @@ services:
```makefile
# Makefile
echo:
docker-compose run --rm node npm run echo
docker compose run --rm node npm run echo
```
```bash
Expand Down
6 changes: 3 additions & 3 deletions docs/guide/project-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This approach relies on official Docker images to manage dependencies. For insta
Example from The [3 Musketeers repository](https://github.com/flemay/3musketeers):

```yaml
# docker-compose.yml
# compose.yml
services:
node:
image: node
Expand All @@ -25,7 +25,7 @@ services:
Official images may not always solve project's dependency requirements and if other projects share the same requirements, then custom Docker images may be a good fit. The images are built by the organization, and deployed to a Docker registry. From a project perspective, it is the same as using official Docker images except, this time, the organization is responsible of maintaining them.

```yaml
# docker-compose.yml
# compose.yml
services:
theservice:
image: theorganisation/theimage
Expand All @@ -50,7 +50,7 @@ RUN npm install -g \
```

```yaml
# docker-compose.yml
# compose.yml
services:
mycontainer:
build: .
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"docker",
"make",
"makefile",
"compose",
"docker-compose",
"cicd",
"methodology"
Expand Down

0 comments on commit ee14ba0

Please sign in to comment.