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

Pull missing images on run. Addresses #31. #49

Merged
merged 11 commits into from
Mar 13, 2013
Merged

Conversation

chooper
Copy link
Contributor

@chooper chooper commented Mar 12, 2013

Pull missing images on run. Addresses #31.

chooper@chimay:~/projects/docker/bin$ ./docker images
NAME                ID                  CREATED             PARENT
chooper@chimay:~/projects/docker/bin$ ./docker run -a base echo "hello world"
Downloading from http://s3.amazonaws.com/docker.io/images/base
Unpacking to base
######################################################################## 100.0%
base:e9cb4ad9173245ac
hello world
chooper@chimay:~/projects/docker/bin$ ./docker run -a base echo "hello world"
hello world
chooper@chimay:~/projects/docker/bin$ ./docker run -a nosuchimage echo "hello world"
Downloading from http://s3.amazonaws.com/docker.io/images/nosuchimage
Unpacking to nosuchimage
######################################################################## 100.0%
Error: Error downloading image: nosuchimage
chooper@chimay:~/projects/docker/bin$

	chooper@chimay:~/projects/docker/bin$ ./docker images
	NAME                ID                  CREATED             PARENT
	chooper@chimay:~/projects/docker/bin$ ./docker run -a base echo "hello world"
	Downloading from http://s3.amazonaws.com/docker.io/images/base
	Unpacking to base
	######################################################################## 100.0%
	base:e9cb4ad9173245ac
	hello world
	chooper@chimay:~/projects/docker/bin$ ./docker run -a base echo "hello world"
	hello world
	chooper@chimay:~/projects/docker/bin$ ./docker run -a nosuchimage echo "hello world"
	Downloading from http://s3.amazonaws.com/docker.io/images/nosuchimage
	Unpacking to nosuchimage
	######################################################################## 100.0%
	Error: Error downloading image: nosuchimage
	chooper@chimay:~/projects/docker/bin$
@shykes
Copy link
Contributor

shykes commented Mar 12, 2013

Thanks for the contribution!

You can use ioutil.Discard instead of os.Open("/dev/null")

It's in package io/ioutil

@shykes
Copy link
Contributor

shykes commented Mar 12, 2013

Also, how does it behave when you pin the image version?

  • If I run 'docker run base:NO_SUCH_ID' does it try running it even if another ID is available?

@chooper
Copy link
Contributor Author

chooper commented Mar 12, 2013

The run fails because "dotcloud pull" fails:

chooper@chimay:~/projects/docker/bin$ ./docker run -a base:d34db33f echo "hello world"
Downloading from base:d34db33f
Unpacking to base:d34db33f
curl: (6) Couldn't resolve host 'base'
base:d34db33f:e3b0c44298fc1c14
lxc-start: No such file or directory - failed to mount 'proc' on '/usr/lib/x86_64-linux-gnu/lxc//proc'
lxc-start: failed to setup the mount entries for '87926c6f'
lxc-start: failed to setup the container
lxc-start: invalid sequence number 1. expected 2
lxc-start: failed to spawn '87926c6f'

I'll add better error checking for CmdRun and open a separate issue for CmdPull:

chooper@chimay:~/projects/docker/bin$ ./docker pull base:d34db33f
Downloading from base:d34db33f
Unpacking to base:d34db33f
curl: (6) Couldn't resolve host 'base'
base:d34db33f:e3b0c44298fc1c14

@chooper
Copy link
Contributor Author

chooper commented Mar 12, 2013

Don't merge this pull request yet. I just noticed that rev 8e0986c breaks the progress bar on "docker pull"

@chooper
Copy link
Contributor Author

chooper commented Mar 12, 2013

This is ready for review

@chooper
Copy link
Contributor Author

chooper commented Mar 12, 2013

I made those last improvements I wanted to make. I didn't remove "curl" from the requirements in the README because we might be telling people to download installer scripts that way.

Conflicts:
	image/image.go
	server/server.go
@chooper
Copy link
Contributor Author

chooper commented Mar 13, 2013

Still fighting with unit tests, I'll ping you when this is ready for re-review/merge

@chooper
Copy link
Contributor Author

chooper commented Mar 13, 2013

Unit tests passing, except for layers_test which appears to be broken in master as well.

@shykes shykes merged commit 8c2ff93 into moby:master Mar 13, 2013
@chooper chooper deleted the pull-missing branch March 13, 2013 20:55
crosbymichael added a commit to crosbymichael/docker that referenced this pull request Nov 20, 2013
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

Successfully merging this pull request may close these issues.

None yet

2 participants