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

Implement -f / --file argument in container-script #7099

Closed

Conversation

glance-
Copy link

@glance- glance- commented Dec 18, 2019

When using -f / --file argument to container-script, and pointing it to
some path which isn't beneath cwd or home, the call would have failed
previously, like:
$ docker-compose -f /tmp/docker-compose.yml up
ERROR: .FileNotFoundError: [Errno 2] No such file or directory: '/tmp/docker-compose.yml'

After this patch:
$ docker-compose -f /tmp/docker-compose.yml up
Creating tmp_alpine_1 ... done
Attaching to tmp_alpine_1
tmp_alpine_1 exited with code 0

It also aborts the parsing at docker-compose verbs so it doesn't
confuse docker-compose args with anything thats ment for a command in
the container:
$ docker-compose -f /tmp/docker-compose.yml run alpine echo --file /tmp/kex.xml
--file /tmp/kex.xml

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "container-script-file-argument" git@github.com:glance-/compose.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

When using -f / --file argument to container-script, and pointing it to
some path which isn't beneath cwd or home, the call would have failed
previously, like:
$ docker-compose -f /tmp/docker-compose.yml up
ERROR: .FileNotFoundError: [Errno 2] No such file or directory: '/tmp/docker-compose.yml'

After this patch:
$ docker-compose -f /tmp/docker-compose.yml up
Creating tmp_alpine_1 ... done
Attaching to tmp_alpine_1
tmp_alpine_1 exited with code 0

It also aborts the parsing at docker-compose verbs so it doesn't
confuse docker-compose args with anything thats ment for a command in
the container:
$ docker-compose -f /tmp/docker-compose.yml run alpine echo --file /tmp/kex.xml
--file /tmp/kex.xml

Signed-off-by: Anton Lundin <glance@acc.umu.se>
@glance- glance- force-pushed the container-script-file-argument branch from 39190d5 to 3357180 Compare December 18, 2019 09:51
glance- pushed a commit to glance-/puppet-sunet that referenced this pull request Dec 18, 2019
This way, we won't try to mount any container arguments into the
docker-compose container, or anything else weird.

This also adds support for the --file= syntax which didn't work before.

This change is proposed to upstream as:
docker/compose#7099
glance- pushed a commit to glance-/puppet-sunet that referenced this pull request Dec 18, 2019
This way, we won't try to mount any container arguments into the
docker-compose container, or anything else weird.

This also adds support for the --file= syntax which didn't work before.

This change is proposed to upstream as:
docker/compose#7099
@ulyssessouza ulyssessouza self-assigned this Jan 9, 2020
@glours
Copy link
Contributor

glours commented Jul 27, 2022

Thanks for taking the time to create this issue/pull request!

Unfortunately, Docker Compose V1 has reached end-of-life and we are not accepting any more changes (except for security issues). Please try and reproduce your issue with Compose V2 or rewrite your pull request to be based on the v2 branch and create a new issue or PR with the relevant Compose V2 information.

@glours glours closed this Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants