Run docker after building own image

2019-07-16 12:01发布

After a previous post it was suggested to create my own Docker image, I wanted to have jenkins with ruby, so my dockerfile looks like

FROM jenkins
FROM ruby:2.3.0

I run docker build -t jenkins_ruby .

It builds correctly and i can see the image when i do docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
jenkins             latest              77bd697ef2c3        5 days ago          710.1 MB
jenkins_ruby        latest              1653f4c3a826        8 days ago          729 MB
ruby                latest              1653f4c3a826        8 days ago          729 MB

So i then want to run this image in a container docker run -p 8080:8080 jenkins_ruby

but i get Switch to inspect mode.

I was expecting to be able to go to ipaddress:8080 and see the jenkins console

Have i missed something?

Thanks

1条回答
爷、活的狠高调
2楼-- · 2019-07-16 12:23

A Dockerfile cannot have multiple FROMs.

This type of functionality to essentially merge two images together cannot be done in a single Dockerfile. All that's really happening here is that it will pull the jenkins:latest image, pull the ruby:2.3.0 image and then tag the ruby image with jenkins_ruby. There is no merging occurring, you can see that with the image final sizes too, jenkins_ruby has an identical size to ruby.

There's a Github issue to back this up here.

查看更多
登录 后发表回答