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

Issues creating an image from a git repository #502

Open
sumdog opened this issue Nov 1, 2017 · 0 comments
Open

Issues creating an image from a git repository #502

sumdog opened this issue Nov 1, 2017 · 0 comments

Comments

@sumdog
Copy link

sumdog commented Nov 1, 2017

From the docker command line, I can run the following to build a container from a git repository:

docker build -t dyject_web git://github.com/sumdog/dyject_web.git

If I try the following:

Docker::Image.create('fromSrc' => 'git://github.com/sumdog/dyject_web.git')

I see the following:

/usr/lib64/ruby/2.2.0/uri/rfc2396_parser.rb:304:in `escape': undefined method `gsub' for nil:NilClass (NoMethodError)
	from /usr/lib64/ruby/2.2.0/uri/common.rb:99:in `escape'
	from /home/cassius/.gem/ruby/2.2.0/gems/docker-api-1.33.6/lib/docker/image.rb:129:in `get'
	from /home/cassius/.gem/ruby/2.2.0/gems/docker-api-1.33.6/lib/docker/image.rb:124:in `create'
	from /home/cassius/workspace/b2/lib/docker.rb:144:in `block in launch_containers'
	from /home/cassius/workspace/b2/lib/docker.rb:136:in `each'
	from /home/cassius/workspace/b2/lib/docker.rb:136:in `map'
	from /home/cassius/workspace/b2/lib/docker.rb:136:in `launch_containers'
	from /home/cassius/workspace/b2/lib/docker.rb:27:in `initialize'
	from ./bee2:102:in `new'
	from ./bee2:102:in `<main>'

So I started digging through the Docker API and found the Image/Build takes an argument 'remote'. So I tried the following:

          Docker::Image.build('remote' => src)

But then get the following stack trace:

  /usr/lib64/ruby/site_ruby/2.2.0/rubygems/package/tar_header.rb:131:in `initialize': :name, :size, :prefix and :mode required (ArgumentError)
from /usr/lib64/ruby/site_ruby/2.2.0/rubygems/package/tar_writer.rb:126:in `new'
from /usr/lib64/ruby/site_ruby/2.2.0/rubygems/package/tar_writer.rb:126:in `add_file'
from /home/cassius/.gem/ruby/2.2.0/gems/docker-api-1.33.6/lib/docker/util.rb:127:in `block (2 levels) in create_tar'
from /home/cassius/.gem/ruby/2.2.0/gems/docker-api-1.33.6/lib/docker/util.rb:125:in `each'
from /home/cassius/.gem/ruby/2.2.0/gems/docker-api-1.33.6/lib/docker/util.rb:125:in `block in create_tar'
from /usr/lib64/ruby/site_ruby/2.2.0/rubygems/package/tar_writer.rb:86:in `new'
from /home/cassius/.gem/ruby/2.2.0/gems/docker-api-1.33.6/lib/docker/util.rb:124:in `create_tar'
from /home/cassius/.gem/ruby/2.2.0/gems/docker-api-1.33.6/lib/docker/image.rb:249:in `build'
from /home/cassius/workspace/b2/lib/docker.rb:144:in `block in launch_containers'
from /home/cassius/workspace/b2/lib/docker.rb:136:in `each'
from /home/cassius/workspace/b2/lib/docker.rb:136:in `map'
from /home/cassius/workspace/b2/lib/docker.rb:136:in `launch_containers'
from /home/cassius/workspace/b2/lib/docker.rb:27:in `initialize'
from ./bee2:102:in `new'
from ./bee2:102:in `<main>'

So it looks like the ruby code is treating this as a build from a tar file call. What's the correct way to build a docker image from a git repository?

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

1 participant