Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot specify compose file with environment variable #347

Closed
sam-berning opened this issue Apr 6, 2023 · 1 comment
Closed

Cannot specify compose file with environment variable #347

sam-berning opened this issue Apr 6, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@sam-berning
Copy link
Contributor

Describe the bug
If I specify the COMPOSE_FILE environment variable in my local shell, it will be ignored by Finch when searching for compose files. The variable is not shared with the Finch VM.

Steps to reproduce

$ mv docker-compose.yaml sam-compose.yaml
$ export COMPOSE_FILE=sam-compose.yaml
$ finch compose up                    
FATA[0000] no configuration file provided: not found    
FATA[0000] exit status 1

Expected behavior
Finch should be able to find the compose file specified in the COMPOSE_FILE env variable.
https://docs.docker.com/compose/environment-variables/envvars/#compose_file

@sam-berning sam-berning added the bug Something isn't working label Apr 6, 2023
@sam-berning sam-berning self-assigned this Apr 6, 2023
@haytok haytok self-assigned this Jun 21, 2024
haytok added a commit to haytok/finch that referenced this issue Jun 23, 2024
nerdctl allows us to launch containers using a Docker Compose file
specified in the COMPOSE_FILE environment variable.

For example, suppose we have created the following Docker Compose file.

```
> cat a.yaml
services:
  test:
    image: amazonlinux:2023
```

By specifying this Docker Compose file in the COMPOSE_FILE environment
variable and running nerdctl compose up, we can start the container.

```
> sudo COMPOSE_FILE=a.yaml _output/nerdctl compose up
INFO[0000] Ensuring image amazonlinux:2023
INFO[0000] Re-creating container nerdctl-test-1
INFO[0000] Attaching to logs
INFO[0000] Container "nerdctl-test-1" exited
INFO[0000] All the containers have exited
INFO[0000] Stopping containers (forcibly)
INFO[0000] Stopping container nerdctl-test-1
```

However, since the COMPOSE_FILE environment variable is not passed in
finch compose, the following error occurs.

```
> COMPOSE_FILE=a.yaml finch compose up
FATA[0000] no configuration file provided: not found
FATA[0000] exit status 1
```

And this bug is reported in the following issue.

- runfinch#347

Therefore, this fix allows the finch compose command to use the Docker
Compose file specified in the COMPOSE_FILE environment variable.

Signed-off-by: Hayato Kiwata <haytok@amazon.co.jp>
haytok added a commit to haytok/finch that referenced this issue Jun 27, 2024
nerdctl allows us to launch containers using a Docker Compose file
specified in the COMPOSE_FILE environment variable.

For example, suppose we have created the following Docker Compose file.

```
> cat a.yaml
services:
  test:
    image: amazonlinux:2023
```

By specifying this Docker Compose file in the COMPOSE_FILE environment
variable and running nerdctl compose up, we can start the container.

```
> sudo COMPOSE_FILE=a.yaml _output/nerdctl compose up
INFO[0000] Ensuring image amazonlinux:2023
INFO[0000] Re-creating container nerdctl-test-1
INFO[0000] Attaching to logs
INFO[0000] Container "nerdctl-test-1" exited
INFO[0000] All the containers have exited
INFO[0000] Stopping containers (forcibly)
INFO[0000] Stopping container nerdctl-test-1
```

However, since the COMPOSE_FILE environment variable is not passed in
finch compose, the following error occurs.

```
> COMPOSE_FILE=a.yaml finch compose up
FATA[0000] no configuration file provided: not found
FATA[0000] exit status 1
```

And this bug is reported in the following issue.

- runfinch#347

Therefore, this fix allows the finch compose command to use the Docker
Compose file specified in the COMPOSE_FILE environment variable.

Signed-off-by: Hayato Kiwata <haytok@amazon.co.jp>
haytok added a commit that referenced this issue Jun 28, 2024
nerdctl allows us to launch containers using a Docker Compose file
specified in the COMPOSE_FILE environment variable.

For example, suppose we have created the following Docker Compose file.

```
> cat a.yaml
services:
  test:
    image: amazonlinux:2023
```

By specifying this Docker Compose file in the COMPOSE_FILE environment
variable and running nerdctl compose up, we can start the container.

```
> sudo COMPOSE_FILE=a.yaml _output/nerdctl compose up
INFO[0000] Ensuring image amazonlinux:2023
INFO[0000] Re-creating container nerdctl-test-1
INFO[0000] Attaching to logs
INFO[0000] Container "nerdctl-test-1" exited
INFO[0000] All the containers have exited
INFO[0000] Stopping containers (forcibly)
INFO[0000] Stopping container nerdctl-test-1
```

However, since the COMPOSE_FILE environment variable is not passed in
finch compose, the following error occurs.

```
> COMPOSE_FILE=a.yaml finch compose up
FATA[0000] no configuration file provided: not found
FATA[0000] exit status 1
```

And this bug is reported in the following issue.

- #347

Therefore, this fix allows the finch compose command to use the Docker
Compose file specified in the COMPOSE_FILE environment variable.

Issue #, if available: #347

*Description of changes:* The details are described in this commit
message.

*Testing done:* Yes



- [x] I've reviewed the guidance in CONTRIBUTING.md


#### License Acceptance

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

---------

Signed-off-by: Hayato Kiwata <haytok@amazon.co.jp>
@Shubhranshu153
Copy link
Contributor

shubhum@147ddaa42911 Documents %  COMPOSE_FILE=a.yaml finch compose up
INFO[0000] Creating network documents_default
INFO[0000] Ensuring image amazonlinux:2023
docker.io/library/amazonlinux:2023:                                               resolved       |++++++++++++++++++++++++++++++++++++++|
index-sha256:07900cb42ce7c5620507a79d02274d4257bc754a8359d1c7b4b52e61ffd14987:    done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:abc43294618e76036aacbb1c60787496b9d4e16d79156ee026c5ee3544c45f82: done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:a4a3c84f8300d08ea3f41129bb67e5848797024e41933a35ed4ac55206111130:   done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:36abe32954e208232b374495838288731226df866aaad9291ccd46166b252416:    done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 19.2s                                                                    total:  49.9 M (2.6 MiB/s)
INFO[0019] Creating container documents-test-1
INFO[0019] Attaching to logs
INFO[0020] Container "documents-test-1" exited
INFO[0020] All the containers have exited
INFO[0020] Stopping containers (forcibly)
INFO[0020] Stopping container documents-test-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants