Packer stopping processes running on base image container

I am using below packer.json file to put war file into tomcat container & build it

“builders”: [{
“type”: “docker”,
“image”: “tomcat:8.0”,
“commit”: “true”
“provisioners”: [
“type”: “file”,
“source”: “sample.war”,
“destination”: “/usr/local/tomcat/webapps/”
“post-processors”: [
“type”: “docker-tag”,
“repository”: “satwikmukherjee/runner-poc”,
“tag”: “{{timestamp}}”
“type”: “docker-push”,
“login”: “true”,
“login_username”: “####”,
“login_password”: “####”

After building while I am running the image committed , within container I am seeing tomcat is not running ,

But while I am doing the same stuff through Dockerfile , no issue found , Dockerfile used as below with the same logic .

FROM tomcat:8.0
COPY sample.war /usr/local/tomcat/webapps/

Please let me know if I am doing anything wrong …



It seems Packer clears the image’s CMD, even though it was not defined in the Packer template. There’s an open issue for this on GitHub -

The workaround seems to be setting "run_command": ["--detach", "{{ .Image }}"] in the template, in order to utilize the CMD defined in the base image.

Here’s an example.

Base tomcat image’s CMD

$ docker inspect tomcat:8.0 --format "{{ .Config.Cmd }}"
[ run]


  "builders": [
      "type": "docker",
      "image": "tomcat:8.0",
      "commit": "true",
      "run_command": [
        "{{ .Image }}"
  "provisioners": [
      "type": "file",
      "source": "sample.war",
      "destination": "/usr/local/tomcat/webapps/"

Resultant image’s CMD

$ docker inspect <image name or ID> --format "{{ .Config.Cmd }}"
[ run]

Hope this helps.