0

I am using https://sbt-native-packager.readthedocs.io/en/stable/introduction.html to build my scala application and would like the publish the application as a local docker container.

I entered the following command:

sbt docker:publishLocal  

I think, everything went fine and I've got an image generated:

docker images
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
sapmock             0.1                 db261ab225b5        About a minute ago   664MB
<none>              <none>              0940c75d8e5a        About a minute ago   703MB
openjdk             8                   bec43387959a        10 days ago          625MB 

Why did sbt create an image <none>?

And when I run the image as a container, it stops immediately:

~/scala/sapmock$ docker run -d -p 8080:80 sapmock:0.1
91abf0e00e3a46baa78a09b9eccd3c562ae82d5b058d5e122e8927f8e7307afd

~/scala/sapmock$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES
91abf0e00e3a        sapmock:0.1         "/opt/docker/bin/sap…"   10 seconds ago      Exited (0) 8 seconds ago                       upbeat_brattain

~/scala/sapmock$ docker ps 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES 

Why?

Resources can be find here: https://gitlab.com/sweetsoft/sapmock

In addition, the content of the generated docker file:

FROM openjdk:8 as stage0
WORKDIR /opt/docker
COPY opt /opt
USER root
RUN ["chmod", "-R", "u=rX,g=rX", "/opt/docker"]
RUN ["chmod", "u+x,g+x", "/opt/docker/bin/sapmock"]

FROM openjdk:8
USER root
RUN id -u demiourgos728 2> /dev/null || (( getent group 0 || groupadd -g 0 root ) && useradd --system --create-home --uid 1001 --gid 0 demiourgos728 )
WORKDIR /opt/docker
COPY --from=stage0 --chown=demiourgos728:root /opt/docker /opt/docker
EXPOSE 8080
USER 1001:0
ENTRYPOINT ["/opt/docker/bin/sapmock"]
CMD []
softshipper
  • 32,463
  • 51
  • 192
  • 400
  • partly a duplicate of https://stackoverflow.com/a/28214133/5986907 ... ? – joel May 18 '19 at 10:44
  • Do you get any error output? Maybe try without the `-d` first to see the console output. – Thilo May 18 '19 at 11:25
  • I've tried with `docker run -it --name sapmock -p 8080:8080 "docker run" requires at least 1 argument. See 'docker run --help'. ` as you can see, I've got an error message. – softshipper May 18 '19 at 11:49
  • 1
    Docker is expecting a command and args at the end. Can you run try using: `docker run -it --name sapmock -p 8080:8080 sapmock ./opt/docker/bin/sapmock`? – emran May 18 '19 at 15:17
  • but as you can see, the entrypoint is `ENTRYPOINT ["/opt/docker/bin/sapmock"]` – softshipper May 18 '19 at 17:58

0 Answers0