Thanks Rickard! I used the following packer.json and it worked however I
have couple questions

{

  "builders": [

    {

      "type": "docker",

      "image": "enonic/docker-salt-masterless-ubuntu",

      "export_path": "cassandra.tar"

    }

  ],

  "provisioners": [

    {

      "type": "salt-masterless",

      "local_state_tree": "/srv/salt",

      "custom_state": "cassandra-local",

      "skip_bootstrap": true,

      "disable_sudo": true

    }

  ]

}

What is export_path ? Why am I giving a tar directory? I thought when I run
packer build packer.json it would build a docker image which I can use to
spawn a container.

when I run packer build packer.json I get the following

*==> docker: Exporting the container*

*==> docker: Killing the container:
b33b07f7f0ecf5026574d29ee28aed0f71659ae11955994ac27fca060c7e7c22*

*Build 'docker' finished.*


I also get a  cassandra.tar which I am not sure how to use to spawn a
container?


On Sun, Dec 10, 2017 at 10:32 PM, Rickard von Essen <
[email protected]> wrote:

> See my answer on SO https://stackoverflow.com/a/47747555/226174
>
> On 10 December 2017 at 22:12, kant kodali <[email protected]> wrote:
>
>> Can anyone here provide a simple working example using my packer.json
>> file in my previous email ? That would be super helpful since I can try
>> running things myself and understand how things work underneath.
>>
>>
>>
>> On Sun, Dec 10, 2017 at 1:02 PM, kant kodali <[email protected]> wrote:
>>
>>> I tried the following
>>>
>>>
>>> {
>>>
>>>   "builders": [
>>>
>>>     {
>>>
>>>       "type": "docker",
>>>
>>>       "image": "enonic/docker-salt-masterless-ubuntu",
>>>
>>>       "export_path": "cassandra.tar"
>>>
>>>     }
>>>
>>>   ],
>>>
>>>   "provisioners": [
>>>
>>>     {
>>>
>>>       "type": "file",
>>>
>>>       "source": "/srv/salt/cassandra",  // I moved cassandra directory
>>> to this location in host
>>>
>>>       "destination": "/srv/salt/cassandra" // I was expecting this is
>>> the location inside container it will get copied too but didn't work
>>>
>>>     },
>>>
>>>     {
>>>
>>>       "type": "salt-masterless",
>>>
>>>       "local_state_tree": "/srv/salt/cassandra",
>>>
>>>       "custom_state": "/srv/salt/cassandra/init.sls",
>>>
>>>       "disable_sudo": true
>>>
>>>     }
>>>
>>>   ]
>>>
>>> }
>>>
>>> sudo packer build  packer.json
>>>
>>>
>>> *Build 'docker' errored: Failed to upload to '/srv/salt/cassandra' in
>>> container: Error response from daemon: lstat
>>> /var/lib/docker/aufs/mnt/0c6a422400a073624a66b00580a6b9e5551e82a06495c46b1f840b38ca55699d/srv/salt:
>>> no such file or directory*
>>>
>>> *. exit status 1.*
>>>
>>> On Sun, Dec 10, 2017 at 12:38 PM, kant kodali <[email protected]>
>>> wrote:
>>>
>>>> Can I see an example please?
>>>>
>>>> On Sun, Dec 10, 2017 at 2:33 AM, Alvaro Miranda Aguilera <
>>>> [email protected]> wrote:
>>>>
>>>>> you can mount the same folder in the docker or you can use a file
>>>>> provisioner to copy them
>>>>>
>>>>> Alvaro.
>>>>>
>>>>> On Sat, Dec 9, 2017 at 9:50 PM, kant kodali <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> I am running packer build  packer.json on my host machine and I
>>>>>> believe salt-call is executing inside the docker container so how does it
>>>>>> pickup my cassandra state files located in host machine (as you can see 
>>>>>> the
>>>>>> path I specified in my packer.json in my previous email)? What steps I 
>>>>>> need
>>>>>> to do?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> On Saturday, December 9, 2017 at 12:38:31 PM UTC-8, kant kodali wrote:
>>>>>>>
>>>>>>> Hi Alvaro,
>>>>>>>
>>>>>>> I think I got that part ok(at least I am hoping).
>>>>>>>
>>>>>>> My packer.json is just this
>>>>>>>
>>>>>>> {
>>>>>>>
>>>>>>>   "builders": [
>>>>>>>
>>>>>>>     {
>>>>>>>
>>>>>>>       "type": "docker",
>>>>>>>
>>>>>>>       "image": "enonic/docker-salt-masterless-ubuntu",
>>>>>>>
>>>>>>>       "export_path": "cassandra.tar"
>>>>>>>
>>>>>>>     }
>>>>>>>
>>>>>>>   ],
>>>>>>>
>>>>>>>   "provisioners": [
>>>>>>>
>>>>>>>     {
>>>>>>>
>>>>>>>       "type": "salt-masterless",
>>>>>>>
>>>>>>>       "local_state_tree": "/home/ubuntu/saltstack",
>>>>>>>
>>>>>>>       "custom_state": "/home/ubuntu/saltstack/cassandra",
>>>>>>>
>>>>>>>       "disable_sudo": true
>>>>>>>
>>>>>>>     }
>>>>>>>
>>>>>>>   ]
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> I just want to build a docker image using salt state files that are
>>>>>>> located in "/home/ubuntu/saltstack/cassandra".
>>>>>>>
>>>>>>> When I run packer build  packer.json. I get the following putput
>>>>>>>
>>>>>>> *docker output will be in this color.*
>>>>>>>
>>>>>>>
>>>>>>> *==> docker: Creating a temporary directory for sharing data...*
>>>>>>>
>>>>>>> *==> docker: Pulling Docker image:
>>>>>>> enonic/docker-salt-masterless-ubuntu*
>>>>>>>
>>>>>>>     docker: Using default tag: latest
>>>>>>>
>>>>>>>     docker: latest: Pulling from enonic/docker-salt-masterless-
>>>>>>> ubuntu
>>>>>>>
>>>>>>>     docker: a3ed95caeb02: Already exists
>>>>>>>
>>>>>>>     docker: 831a6feb5ab2: Already exists
>>>>>>>
>>>>>>>     docker: 9a80cf3dc0d4: Already exists
>>>>>>>
>>>>>>>     docker: 0b7e0d746c2a: Already exists
>>>>>>>
>>>>>>>     docker: caa529e47699: Already exists
>>>>>>>
>>>>>>>     docker: cc3d786e1a1d: Already exists
>>>>>>>
>>>>>>>     docker: a3ed95caeb02: Already exists
>>>>>>>
>>>>>>>     docker: a3ed95caeb02: Already exists
>>>>>>>
>>>>>>>     docker: 542bb8386cb7: Already exists
>>>>>>>
>>>>>>>     docker: 85d9f5a7e4c4: Already exists
>>>>>>>
>>>>>>>     docker: 8d957d809ea4: Already exists
>>>>>>>
>>>>>>>     docker: 0b3aea992171: Already exists
>>>>>>>
>>>>>>>     docker: 55d33ae09bd1: Already exists
>>>>>>>
>>>>>>>     docker: 783a588e9033: Already exists
>>>>>>>
>>>>>>>     docker: f5baec465fa6: Already exists
>>>>>>>
>>>>>>>     docker: be1db5170aaa: Already exists
>>>>>>>
>>>>>>>     docker: a3ed95caeb02: Already exists
>>>>>>>
>>>>>>>     docker: a3ed95caeb02: Already exists
>>>>>>>
>>>>>>>     docker: Digest: sha256:5a89f581b9e4360eebf3133
>>>>>>> c6611b68ca359d69f80edca3f0a7c091e859377c2
>>>>>>>
>>>>>>>     docker: Status: Image is up to date for
>>>>>>> enonic/docker-salt-masterless-ubuntu:latest
>>>>>>>
>>>>>>> *==> docker: Starting docker container...*
>>>>>>>
>>>>>>>     docker: Run command: docker run -v
>>>>>>> /home/ubuntu/.packer.d/tmp/packer-docker794493932:/packer-files -d
>>>>>>> -i -t enonic/docker-salt-masterless-ubuntu /bin/bash
>>>>>>>
>>>>>>>     docker: Container ID: cd0129f12041cf56cca6611b385486
>>>>>>> 44a44b7faac86b6a22572a995aec14b463
>>>>>>>
>>>>>>> *==> docker: Provisioning with Salt...*
>>>>>>>
>>>>>>>     docker: Downloading saltstack bootstrap to /tmp/install_salt.sh
>>>>>>>
>>>>>>>     docker: /bin/sh: 1: curl: not found
>>>>>>>
>>>>>>>     docker: /bin/sh: 1: wget: not found
>>>>>>>
>>>>>>>     docker: Installing Salt with command sh /tmp/install_salt.sh
>>>>>>>
>>>>>>>     docker: sh: 0: Can't open /tmp/install_salt.sh
>>>>>>>
>>>>>>>     docker: Creating remote temporary directory: /tmp/salt
>>>>>>>
>>>>>>>     docker: Creating directory: /tmp/salt
>>>>>>>
>>>>>>>     docker: Uploading local state tree: /home/ubuntu/saltstack
>>>>>>>
>>>>>>>     docker: Creating directory: /tmp/salt/states
>>>>>>>
>>>>>>>     docker: Removing directory: /srv/salt
>>>>>>>
>>>>>>>     docker: Moving /tmp/salt/states to /srv/salt
>>>>>>>
>>>>>>>     docker: Running: salt-call --local  state.sls
>>>>>>> /home/ubuntu/saltstack/cassandra --file-root=/srv/salt
>>>>>>> --pillar-root=/srv/pillar --retcode-passthrough -l info
>>>>>>>
>>>>>>>     docker: [INFO    ] Found minion id from getfqdn(): cd0129f12041
>>>>>>>
>>>>>>>     docker: [WARNING ] Although 'dmidecode' was found in path, the
>>>>>>> current user cannot execute it. Grains output might not be accurate.
>>>>>>>
>>>>>>>     docker: [WARNING ] Although 'dmidecode' was found in path, the
>>>>>>> current user cannot execute it. Grains output might not be accurate.
>>>>>>>
>>>>>>>     docker: [INFO    ] Loading fresh modules for state activity
>>>>>>>
>>>>>>>     docker: local:
>>>>>>>
>>>>>>>     docker:     Data failed to compile:
>>>>>>>
>>>>>>>     docker: ----------
>>>>>>>
>>>>>>>     docker:     No matching sls found for
>>>>>>> '/home/ubuntu/saltstack/cassandra' in env 'base'
>>>>>>>
>>>>>>> *==> docker: Killing the container:
>>>>>>> cd0129f12041cf56cca6611b38548644a44b7faac86b6a22572a995aec14b463*
>>>>>>>
>>>>>>> *Build 'docker' errored: Error executing salt-call: Bad exit status:
>>>>>>> 1*
>>>>>>>
>>>>>>>
>>>>>>> *Thanks!*
>>>>>>>
>>>>>>> On Sunday, September 17, 2017 at 11:54:25 PM UTC-7, Alvaro Miranda
>>>>>>> Aguilera wrote:
>>>>>>>>
>>>>>>>> Hello
>>>>>>>>
>>>>>>>> you can build one once you get all the steps.
>>>>>>>>
>>>>>>>> moving one step at the time, do you need any help for the packer +
>>>>>>>> docker part ?
>>>>>>>>
>>>>>>>> On Sun, Sep 17, 2017 at 7:22 AM, kant kodali <[email protected]>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hi All,
>>>>>>>>>
>>>>>>>>> Is there an example on how to build docker image using salt
>>>>>>>>> provisioner for cassandra using standard salt cassandra formula
>>>>>>>>> <https://github.com/salt-formulas/salt-formula-cassandra>? I
>>>>>>>>> don't see any examples online of anything similar on how to do this.
>>>>>>>>>
>>>>>>>>> Thanks!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> This mailing list is governed under the HashiCorp Community
>>>>>>>>> Guidelines - https://www.hashicorp.com/community-guidelines.html.
>>>>>>>>> Behavior in violation of those guidelines may result in your removal 
>>>>>>>>> from
>>>>>>>>> this mailing list.
>>>>>>>>>
>>>>>>>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>>>>>>>> IRC: #packer-tool on Freenode
>>>>>>>>> ---
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>> Groups "Packer" group.
>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>> send an email to [email protected].
>>>>>>>>> To view this discussion on the web visit
>>>>>>>>> https://groups.google.com/d/msgid/packer-tool/513ef6b1-7005-
>>>>>>>>> 4bcd-bb60-2cfe4383567a%40googlegroups.com
>>>>>>>>> <https://groups.google.com/d/msgid/packer-tool/513ef6b1-7005-4bcd-bb60-2cfe4383567a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>> .
>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Alvaro
>>>>>>>>
>>>>>>>> --
>>>>>> This mailing list is governed under the HashiCorp Community
>>>>>> Guidelines - https://www.hashicorp.com/community-guidelines.html.
>>>>>> Behavior in violation of those guidelines may result in your removal from
>>>>>> this mailing list.
>>>>>>
>>>>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>>>>> IRC: #packer-tool on Freenode
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Packer" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/packer-tool/73768f51-4cf9-
>>>>>> 4c08-9c60-8b2d186c0440%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/packer-tool/73768f51-4cf9-4c08-9c60-8b2d186c0440%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Alvaro
>>>>>
>>>>> --
>>>>> This mailing list is governed under the HashiCorp Community Guidelines
>>>>> - https://www.hashicorp.com/community-guidelines.html. Behavior in
>>>>> violation of those guidelines may result in your removal from this mailing
>>>>> list.
>>>>>
>>>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>>>> IRC: #packer-tool on Freenode
>>>>> ---
>>>>> You received this message because you are subscribed to a topic in the
>>>>> Google Groups "Packer" group.
>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>>>> pic/packer-tool/rtKGUPB6Cyk/unsubscribe.
>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>> [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/packer-tool/CAHqq0eyjEbcm2
>>>>> pONmp2rO0WDUzB%3DjNVxaKnrLc2NgpERxuz9rQ%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/packer-tool/CAHqq0eyjEbcm2pONmp2rO0WDUzB%3DjNVxaKnrLc2NgpERxuz9rQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>
>> --
>> This mailing list is governed under the HashiCorp Community Guidelines -
>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>> violation of those guidelines may result in your removal from this mailing
>> list.
>>
>> GitHub Issues: https://github.com/mitchellh/packer/issues
>> IRC: #packer-tool on Freenode
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Packer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/packer-tool/CA%2BiiNx-0FG_Ac29Whfx0FROTSEnNnONVGtzRJby%2
>> BK0wtM3Rf7A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/packer-tool/CA%2BiiNx-0FG_Ac29Whfx0FROTSEnNnONVGtzRJby%2BK0wtM3Rf7A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Packer" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/packer-tool/rtKGUPB6Cyk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/CALz9Rt-vmv1Vc%2BY_ZXsORDWG2nJURXGxESMirWmj6MygGo
> -8nA%40mail.gmail.com
> <https://groups.google.com/d/msgid/packer-tool/CALz9Rt-vmv1Vc%2BY_ZXsORDWG2nJURXGxESMirWmj6MygGo-8nA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CA%2BiiNx-JsBJaQgqpYy%2Br1DwxJsnctoGB4i%2BkkdRxei2W6xGZFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to