Skip to content

Commit

Permalink
Merge pull request #210 from cisagov/improvement/update_compose_file_…
Browse files Browse the repository at this point in the history
…format

Update Docker Compose file
  • Loading branch information
mcdonnnj authored Feb 7, 2025
2 parents e42ea25 + 7c0da35 commit dfbbe4c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@ docker run cisagov/example:0.2.0

### Running with Docker Compose ###

1. Create a `docker-compose.yml` file similar to the one below to use [Docker Compose](https://docs.docker.com/compose/).
1. Create a `compose.yml` file similar to the one below to use [Docker Compose](https://docs.docker.com/compose/).

```yaml
---
version: "3.7"
name: skeleton-docker

services:
example:
image: cisagov/example:0.2.0
volumes:
- type: bind
source: <your_log_dir>
target: /var/log
environment:
- ECHO_MESSAGE="Hello from docker compose"
image: cisagov/example:0.2.0
ports:
- target: 8080
published: 8080
protocol: tcp
- protocol: tcp
published: "8080"
target: 8080
volumes:
- source: <your_log_dir>
target: /var/log
type: bind
```
1. Start the container and detach:
Expand All @@ -70,32 +70,32 @@ environment variables. See the
Better lock it in your pocket.
```

1. Then add the secret to your `docker-compose.yml` file:
1. Then add the secret to your `compose.yml` file:

```yaml
---
version: "3.7"
name: skeleton-docker
secrets:
quote_txt:
file: quote.txt
services:
example:
image: cisagov/example:0.2.0
volumes:
- type: bind
source: <your_log_dir>
target: /var/log
environment:
- ECHO_MESSAGE="Hello from docker compose"
image: cisagov/example:0.2.0
ports:
- target: 8080
published: 8080
protocol: tcp
- protocol: tcp
published: "8080"
target: 8080
secrets:
- source: quote_txt
target: quote.txt
volumes:
- source: <your_log_dir>
target: /var/log
type: bind
```

## Updating your container ##
Expand Down Expand Up @@ -192,7 +192,7 @@ The following ports are exposed by this container:
|------|----------------|
| 8080 | Example only; nothing is actually listening on the port |

The sample [Docker composition](docker-compose.yml) publishes the
The sample [Docker composition](compose.yml) publishes the
exposed port at 8080.

## Environment variables ##
Expand Down
18 changes: 9 additions & 9 deletions docker-compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
version: "3.7"

# This Docker composition file is used to build and test the container

name: skeleton-docker

secrets:
quote_txt:
file: ./src/secrets/quote.txt
Expand All @@ -15,23 +15,23 @@ services:
# e.g., --build-arg VERSION=0.0.1
context: .
dockerfile: Dockerfile
image: cisagov/example
init: true
restart: "no"
environment:
- ECHO_MESSAGE=Hello World from docker compose!
image: cisagov/example
init: true
ports:
- target: 8421
published: 8421
- mode: host
protocol: tcp
mode: host
published: "8421"
target: 8421
restart: "no"
secrets:
- source: quote_txt
target: quote.txt

example-version:
# Run the container to collect version information
command: --version
image: cisagov/example
init: true
restart: "no"
command: --version

0 comments on commit dfbbe4c

Please sign in to comment.