I need run command to docker container in a script, i trying with:
docker run -it <container> /bin/bash -c "command"
I had no error but the command is not executed
To use the docker exec command, you will need a running Docker container. If you don't already have a container, start a test container with the following docker run command: docker run -d --name container-name alpine watch "date >> /var/log/date. log"
Docker containers are designed to be accessed as root users to execute commands that non-root users can't execute. We can run a command in a running container using the docker exec. We'll use the -i and -t option of the docker exec command to get the interactive shell with TTY terminal access.
I can not create a new image, i must not stop the service ... I do it manually
It's possible to invoke a command in a running container:
docker exec <container_id> rm -f /tmp/cache/*/*/*
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