Error with copy target .war :s

Hello, how are you here? , what a great community :wink: I’m starting with docker, I have a dockerFile that I created with my intellJ.

My image is apparently created fine, it does all the steps

gcr.io/google-appengine/tomcat:latest
This is my sha256
sha256:f6b79e29d820cd3446902b36b9d1c401858d37b7554384c203a7e0d0bd25f9e5

I have the DockerIntegration plugin

  • Version: 173.3727.15
    This plugin lets you download and build Docker images, create and start Docker containers, and carry out other related tasks. Documentation
    Change Notes
    173.2605:
    IDEA-171370 - Docker: new UI for Docker Deployment Run configuration - separate config types
    IDEA-174375 - Docker run configuration - support --build-arg’s
    IDEA-172716 - Docker - allow build-only Dockerfile run configurations
    IDEA-174209 - Support custom dockerfile names
    IDEA-154517 - Docker: support alternate names for compose yml
    IDEA-170244 - Docker: provide completion and navigation for ADD instruction values
    #######################################################################
    DockerFile
    FROM gcr. io /google-appengine/tomcat
    COPY target/MyWar.war /var/lib/tomcat/webapps/ROOT.war
    ##########################################################
    Deploying ’ Dockerfile: Dockerfile’…
    Building image…
    Step 1/2 : FROM gcr.io/google-appengine/tomcat

—> f6b79e29d820

Step 2/2 : COPY target/MyWar.war /var/lib/tomcat/webapps/ROOT.war

I get this error

Error: ResponseItem.ErrorDetail[code=,message=COPY failed: stat /var/lib/docker/tmp/docker-builder032902590/target/MyWar.war: no such file or directory]
Failed to deploy ’ Dockerfile: Dockerfile’: COPY failed: stat /var/lib/docker/tmp/docker-builder032902590/target/MyWar.war: no such file or directory

that folder, target, is in the same folder as your dockerfile, right?

1 Like

yes sir, thks It is just as it appears in the image

the Dockerfile COPY command copies FROM the docker HOST to the image…

so, that folder

'COPY' **target**/MyWar.war'  

MUST Be on the docker HOST and in the same folder as the dockerfile, during docker build command execution.
(same folder cause it is a relative path)

If it is the same, both the destination folder and the DockerFile are in the same directory,
I see that great detail, the file MyWar.war is not XD, obviously it should be in the target compilation folder but not

if so, I should check that my .war is created well to continue

yes, the war needs to be in that folder

1 Like

It was just that, already generate *.war so I see my application is not displayed in the browser through the ports

I’m interested in localhost:8080, simple

This configuration was added by me
Container Port: 32768
protocol: tcp
Host IP: 0.0.0.0
Host port: 8080

{
“Args” : [ “/bin/bash”, “/usr/local/tomcat/bin/catalina.sh”, “run” ],
“Config” : {
“AttachStderr” : false,
“AttachStdin” : true,
“AttachStdout” : false,
“Cmd” : [ “/bin/bash”, “/usr/local/tomcat/bin/catalina.sh”, “run” ],
“Domainname” : “2ecee4a71c05”,
“Entrypoint” : [ “/docker-entrypoint.bash” ],
“Env” : [ “PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”, “PORT=8080”, “DEBIAN_FRONTEND=noninteractive”, “OPENJDK_VERSION=8u131”, “GAE_IMAGE_NAME=openjdk8”, “GAE_IMAGE_LABEL=8-2018-01-03-19-34”, “APP_DESTINATION=/var/lib/tomcat/webapps/ROOT.war”, “CATALINA_HOME=/usr/local/tomcat”, “CATALINA_BASE=/var/lib/tomcat”, “APP_WAR=ROOT.war”, “APP_EXPLODED_WAR=ROOT/”, “APP_DESTINATION_PATH=/var/lib/tomcat/webapps/”, “APP_DESTINATION_WAR=/var/lib/tomcat/webapps/ROOT.war”, “APP_DESTINATION_EXPLODED_WAR=/var/lib/tomcat/webapps/ROOT/” ],
“ExposedPorts” : {
“32768/tcp” : { },
“8080/tcp” : { }
},
“Hostname” : “2ecee4a71c05”,
“Image” : “34d7a0e6e1f7”,
“Labels” : { },
“OpenStdin” : true,
“StdinOnce” : false,
“Tty” : true,
“User” : “”,
“WorkingDir” : “/var/lib/tomcat/webapps”
},
“Created” : “2018-02-21T20:21:28.984714293Z”,
“Driver” : “overlay2”,
“ExecDriver” : null,
“HostConfig” : {
“Binds” : [ ],
“BlkioWeight” : 0,
“ContainerIDFile” : “”,
“CpuPeriod” : 0,
“CpuShares” : 0,
“CpuQuota” : 0,
“CpusetCpus” : “”,
“CpusetMems” : “”,
“Dns” : [ ],
“DnsSearch” : [ ],
“LogConfig” : {
“Type” : “json-file”,
“Config” : { }
},
“Memory” : 0,
“MemorySwap” : 0,
“MemoryReservation” : 0,
“KernelMemory” : 0,
“NetworkMode” : “default”,
“OomKillDisable” : false,
“OomScoreAdj” : false,
“PortBindings” : { },
“Privileged” : false,
“PublishAllPorts” : false,
“ReadonlyRootfs” : false,
“RestartPolicy” : {
“MaximumRetryCount” : 0,
“Name” : “”
},
“PidMode” : “”,
“CgroupParent” : “”,
“VolumeDriver” : “”,
“ShmSize” : 67108864,
“PidsLimit” : 0
},
“HostnamePath” : “/var/lib/docker/containers/39e9981462532ed854bb78c02cabb70a3398b5969fb8edc3786bed9d5b7bcc52/hostname”,
“HostsPath” : “/var/lib/docker/containers/39e9981462532ed854bb78c02cabb70a3398b5969fb8edc3786bed9d5b7bcc52/hosts”,
“LogPath” : “/var/lib/docker/containers/39e9981462532ed854bb78c02cabb70a3398b5969fb8edc3786bed9d5b7bcc52/39e9981462532ed854bb78c02cabb70a3398b5969fb8edc3786bed9d5b7bcc52-json.log”,
“Id” : “39e9981462532ed854bb78c02cabb70a3398b5969fb8edc3786bed9d5b7bcc52”,
“SizeRootFs” : null,
“Image” : “sha256:34d7a0e6e1f73446ddf7ed481c3fde427747bb23ee65fc208c5c9c53e7e46ca8”,
“MountLabel” : “”,
“Name” : “/suspicious_hodgkin”,
“RestartCount” : 0,
“NetworkSettings” : {
“Bridge” : “”,
“SandboxID” : “cfece13f868d5fb89682ba004b24d31d2969c51f43f466a5afbfa9f7e4a356fc”,
“HairpinMode” : false,
“LinkLocalIPv6Address” : “”,
“LinkLocalIPv6PrefixLen” : 0,
“Ports” : {
“32768/tcp” : null,
“8080/tcp” : null
},
“SandboxKey” : “/var/run/docker/netns/cfece13f868d”,
“SecondaryIPAddresses” : null,
“SecondaryIPv6Addresses” : null,
“EndpointID” : “97294f0599bb6a11050244616585285142ea27ab9cd756a31c3c5d651ea8381e”,
“Gateway” : “172.17.0.1”,
“PortMapping” : null,
“GlobalIPv6Address” : “”,
“GlobalIPv6PrefixLen” : 0,
“IPAddress” : “172.17.0.2”,
“IPPrefixLen” : 16,
“IPv6Gateway” : “”,
“MacAddress” : “02:42:ac:11:00:02”,
“Networks” : {
“bridge” : {
“IPAMConfig” : null,
“Links” : null,
“Aliases” : null,
“NetworkID” : “e6085de4f64e0d9b833dbfe936876bcbe3ae0c55a88b3b81c6a9a92dfe5b769c”,
“EndpointID” : “97294f0599bb6a11050244616585285142ea27ab9cd756a31c3c5d651ea8381e”,
“Gateway” : “172.17.0.1”,
“IPAddress” : “172.17.0.2”,
“IPPrefixLen” : 16,
“IPv6Gateway” : “”,
“GlobalIPv6Address” : “”,
“GlobalIPv6PrefixLen” : 0,
“MacAddress” : “02:42:ac:11:00:02”
}
}
},
“Path” : “/docker-entrypoint.bash”,
“ProcessLabel” : “”,
“ResolvConfPath” : “/var/lib/docker/containers/39e9981462532ed854bb78c02cabb70a3398b5969fb8edc3786bed9d5b7bcc52/resolv.conf”,
“ExecIDs” : null,
“State” : {
“oomkilled” : false,
“Status” : “running”,
“Running” : true,
“Paused” : false,
“Restarting” : false,
“OOMKilled” : false,
“Dead” : false,
“Pid” : 6789,
“ExitCode” : 0,
“Error” : “”,
“StartedAt” : “2018-02-21T20:35:09.452807978Z”,
“FinishedAt” : “2018-02-21T20:35:00.63181189Z”,
“Health” : null
},
“Volumes” : null,
“VolumesRW” : null,
“Mounts” : [ ]
}

That was my problem to build the .war and port binding and ready, solved and functional for me thanks for everything.

Hi … I have a doubt here. Sorry if I am asking any stupid question. How to find the destination for tomcat in a container. Here it is mentioned /var/lib/tomcat/webapps. Is it same for all. I am creating a dockerfile- From tomcat. So could you please tell me what should be my destination path for .war to deploy.