0

I don't want the other party to see the code in my container when the other party pulls the image of my container registered on the docker hub.

Or is there a way to make my container inaccessible with the command of docker exec??

Is there any way to prevent this?

윤태일
  • 537
  • 1
  • 9
  • 21
  • You can't prevent a user from `docker exec` into the container; or `docker run` it with an alternate command (perhaps a bind-mounted BusyBox binary); or `docker save` the image to a tar file where they can look at it later. The best you can do is to use a compiled language and not distribute your source code. – David Maze Feb 17 '21 at 10:11

1 Answers1

1

I don't think its possible. The best thing you can do is to build your docker image using scratch.

FROM scratch
...

But even with that anyone can still add bash to it.

FROM yourimage

USER root
RUN apk add bash

The only way to "hide" your code is if you can compile it and only include the compiled file in the docker image. Docker has great docs on how you can accomplish this through multi-stage builds.

tatsukenji
  • 63
  • 4