Hi,
I am using Docker on my Synology NAS.
I am using the TS3 Musicbot in a Docker container but I do not know how to run a Bash command after starting up the container now I have to do this manually.
Here is the command I have to run now:
cd TS3MusicBot
nohup ./TS3MusicBot_runscript.sh -account “E-MAIL”-port 8484 -webif-pw “PASSWRD” -webif-pw-user “PASSWRD” -number 3 -webif-bind-ip 0.0.0.0 &
I have to do this manually in a Bash after container start, how can I make this automatic?
I want Docker to run this after start up and I have no idea how to do this and I can not find any Synology information about this, can some one please explain this for someone totally new to docker…
example:
create new document on you server with name Dockerfile
FROM debian
MAINTAINER Lucas Simão<lucas.simao01@gmail.com>
RUN apt-get update && apt-get install -y nano && apt-get clean
EXPOSE 8484
ENTRYPOINT "put your code here" && /bin/bash
#exemple ENTRYPOINT service nginx start && service ssh start && /bin/bash "use && to separate your code"
after save your code on /root, create a new image docker using
Thanks! But I do not understand this fully… What if I already have an active working container can I implement this on that so I do not have to start over?
The CMD would not have nohup or end with &: the lifetime of the container is the lifetime of that script, and when the script/server exits, the container exits too.
(In contrast to the previous poster, I pretty strongly believe you should not use ENTRYPOINT for this–it gets in the way of a debugging docker run --rm -it myimage bash too much–and it’s really important to avoid commands like service or systemctl that run init scripts, since you won’t have an init.)
To answer your immediately preceding question, if you have a container already running and need to run some administrative command in it, docker exec will do that, but it’s not intended to be the primary way you get software running in a container.
@satishy18 You can run service if you want to then you have to start one with init and then exec to this docker and start service. Without running init you can work with service and this is expected.