Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does docker image hide my source code?

Tags:

docker

I am thinking of using docker to deliver a software service. The service is written in scripting language (e.g. Python, NodeJS etc), so the docker image will have the source code. Is it easy to "peek" into the docker image to see the source code?

I know this is not the intended use case of docker, but your answers will help me understand better how docker works.

Thanks!

like image 258
yichen Avatar asked Oct 16 '25 10:10

yichen


2 Answers

No, your code won't be hidden at all.

A Docker image is a stack of "layers" that end up being mounted just as a regular filesystem.

Anyone having access to the image can thus see everything that's inside.

You should better consider compiling and/or obfuscating your code, such solutions exist for both Python and NodeJS.

like image 155
mbarthelemy Avatar answered Oct 19 '25 09:10

mbarthelemy


You can use docker run -t -i imageName bash to enter the interactive mode. Then reveal the codes.

like image 24
waitingkuo Avatar answered Oct 19 '25 08:10

waitingkuo