1

I want to upload a zip file to my tomcat container using docker API.

http://{mydockerHost}:2375/containers/{containerId}/archive?path=/usr/local/tomcat/

But this i am getting this kind of expection,

{
    "message": "Error processing tar file(exit status 1): archive/tar: invalid tar header"
}

Kindly solve my problem, Thanks in advance

Manoj M
  • 19
  • 4
  • How are you uploading the file? Where does the error message come from? – Marte Valerio Falcone Apr 16 '21 at 07:26
  • @MarteValerioFalcone I am using postman to do this – Manoj M Apr 16 '21 at 09:33
  • Does [this](https://stackoverflow.com/questions/40622162/docker-load-and-save-archive-tar-invalid-tar-header) answer to your question? – Marte Valerio Falcone Apr 16 '21 at 09:44
  • Remember that anyone who can reach the Docker socket can pretty trivially root the host; if you're allowing unencrypted connections to the Docker socket on port 2375, that means anyone on your local network can take over your machine. I'd disable the relevant Docker daemon option _immediately_, and use only the Unix socket file to talk to Docker (still speaks HTTP but not over TCP). – David Maze Apr 16 '21 at 10:23
  • @DavidMaze then how can I send my files to a container? For my project I need to send some files to the container using docker api. So how can I do it? – Manoj M Apr 16 '21 at 11:22
  • @MarteValerioFalcone the error was same, Here i did this via docker api. – Manoj M Apr 16 '21 at 11:23
  • Typically you'd run something like an HTTP service in your container, publish its port with a `docker run -p` option, and make an HTTP POST request to the service. Unless you're specifically trying to manage containers, I'd avoid the (high-risk, less-portable) Docker API. – David Maze Apr 16 '21 at 11:23

1 Answers1

0

seem you need to download manually the specific docker image file then:

// 1- extract file

// 2- then run this command in its folder

// in my case neo4j docker image

use this:

docker load -i .\neo4j

instead of this

docker load -i .\neo4j.7z

// Error processing tar file(exit status 1): archive/tar: invalid tar header

saber tabatabaee yazdi
  • 4,404
  • 3
  • 42
  • 58