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

create container sends env and port options incorrectly #130

Closed
asquare opened this issue Apr 14, 2015 · 6 comments
Closed

create container sends env and port options incorrectly #130

asquare opened this issue Apr 14, 2015 · 6 comments

Comments

@asquare
Copy link

asquare commented Apr 14, 2015

Trying to create a container with an exposed port and an env var -

docker.createContainer({
Image: 'hello:0.0.1',
Cmd: ['node', 'app.js'],
ExposedPorts: {'80/tcp':{}}
Env: {'PORT':8080}
}, function(err, container) { ...

when run with DEBUG=modem, I see the following on the console -

modem Sending: { path: '/containers/create?Image=e4455111414d&Cmd=node&Cmd=app.js&ExposedPorts=&Env=',
...

Note that Cmd is repeated and ExposedPorts and Env are empty. Also the Docker Remote API says that these should be sent as JSON in the body, are they being sent as query parameters?

@apocas
Copy link
Owner

apocas commented Apr 14, 2015

Docker as a wacky format for env variables, unfortunately nothing we can do from our side. They expect an array of strings with a VARNAME=VALUE format.

docker.createContainer({
    Tty: true,
    Image: imageName, 
    Env: [
        'PORT=8080'
    ]
}, function (err, container) {
    // etc.
});

@apocas apocas closed this as completed Apr 14, 2015
@asquare
Copy link
Author

asquare commented Apr 14, 2015

Thanks - that worked. Might want to add that to one of your examples.

@williamboman
Copy link

👍 on adding this to docs :)

@agrawalapoorv
Copy link

How can we tag the image will commiting (dockerode) ?

@rmg
Copy link
Contributor

rmg commented Aug 6, 2015

@agrawalapoorv this issue appears to be about creating containers, which are not tagged..

For tagging an image, it looks like all of the methods of creating an image accept t and repo parameters, so you should be able to pass {t: 'tag', repo: 'myrepo'} as the options.

@agrawalapoorv
Copy link

Ok thanks alot...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants