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

Add command in Dockerfile #385

Closed
c4po opened this issue Oct 23, 2014 · 8 comments
Closed

Add command in Dockerfile #385

c4po opened this issue Oct 23, 2014 · 8 comments

Comments

@c4po
Copy link

c4po commented Oct 23, 2014

Can we add a new setting key to hold some commands in Dockerfile?
for example, we need run some commands to create a couple of folders before start the application.
or change the application configure file based on docker environment value.

@huntc
Copy link
Contributor

huntc commented Oct 27, 2014

While we're at it, it'd be great to have the option of specifying other docker commands - perhaps as a map even? The latter will then allow us to cope with new commands as they become available.

The command I want right now is ENV. :-)

@fiadliel
Copy link
Contributor

I was reluctant to quickly add this feature because it'll bake in some features that I haven't fully thought about yet. But perhaps it's time to add something -- certainly running some commands after adding files to the image is very valid use case (you need to run them once, but not every time a container is started).

@huntc have you considered bashScriptExtraDefines += """export MYENV="value""""
Almost everything I've needed to do, every time I run an image, has seemed to be possible from there.

@huntc
Copy link
Contributor

huntc commented Oct 27, 2014

have you considered bashScriptExtraDefines += """export MYENV="value""""
Almost everything I've needed to do, every time I run an image, has seemed to be possible from there

Its about being able to pass in environment variables from outside of the docker container in order. I believe that is the purpose of ENV.

@fiadliel
Copy link
Contributor

Not as far as I know: http://docs.docker.com/reference/builder/#env

What you want is docker run --env=... or docker run --env-file=...; that is, altering the docker binary's arguments to pull in environment variables at runtime. This does not require any particular support from the Docker image.

@huntc
Copy link
Contributor

huntc commented Oct 27, 2014

Thanks for the clarification.

@chaliy
Copy link

chaliy commented Nov 29, 2014

+1 to this, technically when you deploy to Amazon AWS Beanstalk, you also need something like this in your Dockerfile

RUN ["chmod", "+x", "bin/appname"]

without this, AWS just says that access is denied.

@frosforever
Copy link
Contributor

Adding to @chaliy, this is needed anytime you zip up the containing code as file permissions are not retained in zip archives. This is not AWS specific.

@raittes
Copy link

raittes commented Jan 5, 2015

+1

andypetrella added a commit to andypetrella/sbt-native-packager that referenced this issue Feb 12, 2015
@muuki88 muuki88 closed this as completed Feb 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants