Docker Community Forums

Share and learn in the Docker community.

Service not starting while starting it using - `docker exec -it container cmd`

docker

(Maxmithun) #1

I was trying start the sshd service in a docker container using the below command,

docker exec -it <container_id> service ssh start
Starting sshd: [ OK ]

docker exec -it <container_id> service ssh status
openssh-daemon is stopped

docker exec -it <container_id> netstat -antlp
Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

but if i get into the bash of the docker container and start the service it is working

docker exec -it <container_id> bash

[root@3c07f19f36d6 /] service ssh start
Starting sshd: [ OK ]

[root@3c07f19f36d6 /] service ssh status
openssh-daemon is running