I need to pass a command parameter with arguments in the style of --param1=arg1
to the run command of a docker container in Synology DSM. The docker application version in the package center is 17.05.0-0401
.
On choosing a docker image and opening the Create Container
window, I found the configuration for the command by going through the following steps:
Advanced Settings
buttonEnvironment
tabCommand:
value under Execution Command
section (For e.g, execname --param1=arg1
However, I received the following error when creating the container.
Run command format error.
Click on the Docker app. Click on Install to install the Docker app on your Synology NAS. Select the volume you want to install and keep Docker data using the dropdown menu and click on Next as marked in the screenshot below. Click on Apply.
Running Commands in an Alternate Directory in a Docker Container. To run a command in a certain directory of your container, use the --workdir flag to specify the directory: docker exec --workdir /tmp container-name pwd.
The docker exec command runs a new command in a running container. The command started using docker exec only runs while the container's primary process ( PID 1 ) is running, and it is not restarted if the container is restarted. COMMAND will run in the default directory of the container.
To publish a port for our container, we'll use the --publish flag ( -p for short) on the docker run command. The format of the --publish command is [host port]:[container port] . So if we wanted to expose port 8000 inside the container to port 3000 outside the container, we would pass 3000:8000 to the --publish flag.
Disclaimer: I am self documenting my own question in hope of helping others as surprisingly this question / issue was quite obscure to resolve.
While testing by trial and error, I discovered that the =
character needs to be escaped with a backslash \
.
Therefore, the following command as per the question example will work correctly, execname --param1\=arg1
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With