Dinesh
Dinesh

Reputation: 1820

Kitchen-Docker specify image name for Dockerfile

I am currently using kitchen-docker driver for testing my cookbooks. Wondering how to specify a image name:tag for the image that is build by the kitchen create command.

Here is my .kitchen.yml :

---
driver:
  name: docker
  use_sudo: false
  dockerfile: ../Dockerfile
  remove_images: true
  privileged: true
  run_command: /usr/sbin/init

provisioner:
  name: chef_zero
  data_bags_path: 'data_bags'
  environments_path: 'environments'
  cookbook_path: "cookbooks"
  client_rb:
    environment: development

platforms:
  - name: centos-7
    driver_config:
      container_name: myapp
      instance_name: myapp


suites:
  - name: default
    run_list:
      - recipe[web_server::default]
      - recipe[app_server::default]
    attributes:

Run the command:

kitchen create

Creates a docker image as <none> I would like to call the image as mycompany/app

REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE
<none>                             <none>              18e663ff7508        17 seconds ago      1.14GB

any help is massively appreciated.

Upvotes: 2

Views: 520

Answers (2)

Dinesh
Dinesh

Reputation: 1820

Actually I found a way to do it.

you can actually pass the build_options: and tag. As shown in the code below.

.kitchen.yml (the full yml file is in the question above.)

platforms:
 - name: centos-7
   driver_config:
    dockerfile: ../Dockerfile
    build_options:
     tag: mycompany/myapp:latest
     rm: true
    container_name: myapp
    instance_name: myapp

Upvotes: 0

coderanger
coderanger

Reputation: 54249

There is no option for this, kitchen-docker doesn't use tags as it doesn't need them, it tracks the build image ID itself.

Upvotes: 1

Related Questions