Docker Container Shouldn't Killed

29 views
Skip to first unread message

Saurabh

unread,
Apr 6, 2018, 3:58:54 AM4/6/18
to Packer
Hi All, 

While Running to Packer Build Command. 

at last Docker Container is getting Killed. 

I don't want docker Container should killed. 

It should run Container. 

************************* 
==> docker: Killing the container: 4fca9b0df6764361fefee08e4053e073ecc869a5de72e76d885dfa4f2f6cda7a
Build 'docker' finished.

**************************
json file : 

*******************************************************************************

{
    "builders": [
        {
            "type": "docker",
            "image": "ubuntu:16.04",
            "commit": "true",
            "pull": "true",
            "changes": [
                "ENTRYPOINT [\"nginx -g 'daemon off;'\"]"
            ]
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "script": "installansible.sh"
        },
        {
            "type": "ansible-local",
            "playbook_file": "test.yml"
        }
    ]
 }

*******************************************************************************

Looking for the solutions. 

Thank you 
Saurabh 

Alvaro Miranda Aguilera

unread,
Apr 6, 2018, 4:15:32 AM4/6/18
to packe...@googlegroups.com
Hello

Packer build a container, and in your code will be commited

if you check


docker images

the top one will be the new one you did.


You can add a post-processor docker-tag to tag that container

ie

"post-processors": [
{
"repository": "myxenial",
"tag": "latest",
"type": "docker-tag"
}
],


Thanks
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 packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/3a2ed913-709f-4998-b370-ddffc2a2680e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Saurabh

unread,
Apr 6, 2018, 6:02:13 AM4/6/18
to Packer
Hi Alvaro, 

Thanks for your response. 

Tagging Name it will not resolve my issue. 

I'm looking something

  • packer should generate the docker image 
  • Ansible will do configuration on docker image
  • and finally Container should run without any manual interaction. 
Please help me for this issue. 

Thank you ! 

Saurabh 
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.



--
Alvaro

Alvaro Miranda Aguilera

unread,
Apr 6, 2018, 6:51:33 AM4/6/18
to packe...@googlegroups.com
Hello

Can you explain more?


Packer is to build docker images, not to run docker images.


After packer is run, no containers should be running as part of this.




To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/8dc2512a-d49a-49ee-bf49-87039d68e22b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Saurabh

unread,
Apr 6, 2018, 7:02:08 AM4/6/18
to Packer
Yes Sure, 

Once Docker Images is Build, After That i want to run Docker Images so that Container can up. 

Docker Images is Build 

****************************************
{
    "builders": [
        {
            "type": "docker",
            "image": "tomcat",
            "commit": "true",
            "pull": "true"

        }
    ],

    "post-processors": [
       {
        "type": "docker-tag",
        "repository": "tomcat",
        "tag": "latest"
       }
    ]
 }

**********************************

Docker Container 

**********************************

docker run -tdp 80:8080 tomcat 

********************************** 

Docker run command should be perform by packer. 

Not by manual. 


Regards
Saurabh 





--
Alvaro

Alvaro Miranda Aguilera

unread,
Apr 6, 2018, 7:29:23 AM4/6/18
to packe...@googlegroups.com
Hello

Packer won't run your docker container.

Packer only build docker images.

You need run it by hand, script or a different tool.

Not sure from where you are getting the idea that packer can be used to run containers, thats what I have been trying to explain.

Alvaro.

Reply all
Reply to author
Forward
0 new messages