Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

3.4K
Visualizações
"Unable to access jarfile" when trying to run a jar with docker

I get Error: Unable to access jarfile jar-runner.jar when trying to run my jar.

Dockerfile:

FROM anapsix/alpine-java
MAINTAINER bramhaag
CMD ["java", "-jar", "jar-runner.jar", "some param", "some param"]

The jar file is located in /home/selfbot/ and I'm running this with Portainer. This is what my Portainer container looks like: Portainer[1]

How would I make this work?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

With CMD [ ] "exec" format, Docker will try to look at the arguments and give its opinion about their usefulness. "Unable to access jarfile" is a Docker message, and it just means Docker has some (unspecified) issues with a jarfile. I've encountered it when the name of the jarfile contained an ENV variable, for instance. Docker couldn't handle that, apparently.

There's also the CMD "shell" format, CMD java -jar jar-runner.jar "some param" "some param". This is known as the shell format because Docker hands of the arguments to /bin/sh -c. As a result, it's not trying to second-guess what the arguments mean. sh in turn doesn't try to be smart either. And java is entirely capable of using jar-runner.jar.

Mind you, if you've got a typo in jar-runner.jar, or you put it in the wrong location, then Docker's message might be right. The shell workaround is useful when Docker guesses wrong.

over 4 years ago · Santiago Trujillo Relatório

0

It looks like you have the volume mounted, so assuming that you are correct that the jar file is available in the container via that volume, you probably just need to specify the path to it so java can find it.

CMD ["java", "-jar", "/home/selfbot/jar-runner.jar", "some param", "some param"]

You can check whether the file is really available by running a different command to just show you the contents of a given directory. Change the command (in Portainer) to something like

ls -la /home/selfbot

And then you can verify whether the jar file is actually where you think it, whether it is readable, etc. This command will exit right away, but its output will be available in the container log.

over 4 years ago · Santiago Trujillo Relatório

0

Try
ENTRYPOINT ["java","-jar","jar-runner.jar"] CMD ["some param"]

I had a similar issue here on my post: Error: Unable to access jarfile when running docker container

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda