I am using a docker run command as follows:
docker run -p 8889:8888 jupyter/minimal-notebook:57f8546c0386 start-notebook.sh --NotebookApp.token=''
I need to change the same in docker compose file. I don't know how to add start-notebook.sh --NotebookApp.token='' in docker-compose. Can i use it as environment variable??
Please let me know how can I include the same in docker compose
CodePudding user response:
In a docker run
command, anything that appears after the image name is interpreted as the command to run, and maps to Compose command:
.
docker run \ # docker options first
-p 8889:8888 \ # port mapping
jupyter/minimal-notebook:57f8546c0386 \ # image name and tag
start-notebook.sh --NotebookApp.token='' # command
version: '3.8'
services:
some_name:
ports: ['8889:8888'] # docker run -p option
image: jupyter/minimal-notebook:57f8546c0386
command: start-notebook.sh --NotebookApp.token=''
Just like with docker run
, if the underlying image has an ENTRYPOINT
declared, the command gets passed as arguments to the entrypoint to form the single main container command; and just like with docker run
, if you need a shell in the container to process the command line (for example to expand environment variables) then you need to explicitly include a sh -c
wrapper as part of the command.