GithubHelp home page GithubHelp logo

Comments (8)

marc- avatar marc- commented on May 13, 2024

There is actually :from_image docker option. Unfortunately it doesn't allow to preserve initial image repository name and tag. It is also skips convergence phase.

from chef-provisioning-docker.

jkeiser avatar jkeiser commented on May 13, 2024

@marc- you should be able to do this:

require "chef/provisioning/docker_driver"
with_driver "docker"
machine_image "machine1" do
  recipe "my_recipe::1"
  machine_options :docker_options => {
      :base_image => {
          :name => "ubuntu",
          :repository => "ubuntu",
          :tag => "14.04"
      }
  }
end

machine_image "machine2" do
  recipe "my_recipe::2"
  from_image 'machine1'
end

from chef-provisioning-docker.

marc- avatar marc- commented on May 13, 2024

This will work for this particular case. But what if you need to run machine from local image, which wasn't created with machine_image and is not available in remote registry, for instance built from Dockerfile?

from chef-provisioning-docker.

marc- avatar marc- commented on May 13, 2024

Modifying my example to make it more clear:

require "chef/provisioning/docker_driver"
with_driver "docker"

machine_image "machine" do
  recipe "my_cookbook::some_recipe"

  machine_options :docker_options => {
      :base_image => {
          :name => "image_built_from_dockerfile",
          :repository => "image_built_from_dockerfile",
          :tag => "latest"
       }
  }
end

from chef-provisioning-docker.

tyler-ball avatar tyler-ball commented on May 13, 2024

I'm just getting up to speed with all this, so I may be wrong. But my initial analysis is that we should support base images from an existing docker image in a remote repository, or a local repository (from a Dockerfile) or another machine_image resource. I think its confusing to have two different ways to specify a base image - 1) via the from_image attribute or 2) from the :base_image hash in the :docker_options.

Because from_image is a base machine_options attribute can we update it to support all the desired behaviors? We could have it accept a string like name:repository:tag (because it only accepts a String now and not a Hash). First, we try to find a resource named name:repository:tag. If we cannot find that, look for an image using the :name, :repository and :tag parsed out from the String.

If we want to keep them separate, I think we should get much better documentation about the difference between the from_image attribute (can only reference other resources) and the :base_image hash in the machine_options attribute (references either a local or remote Docker repo).

\cc @jkeiser

from chef-provisioning-docker.

marc- avatar marc- commented on May 13, 2024

Not sure if it's good idea to put docker specific options into chef-provisioning specific context.
Also, talking about refactoring and confusion, as there any justification for :name base image option?

from chef-provisioning-docker.

randomcamel avatar randomcamel commented on May 13, 2024

The original issue should be fixed by PR #47. @tyler-ball go ahead and close, or leave open for discussion, as desired.

from chef-provisioning-docker.

randomcamel avatar randomcamel commented on May 13, 2024

Reading more carefully I see that Tyler asked me to close it, so. 😄

from chef-provisioning-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.