Changing entrypoint - docker container does not start

Hello,

I created a docker container. Now I want to change entrypoint.
For this I commited my container to new image. With docker-compose I want to create a new container with new entrypoint:

version: ‘2’
services:
Joomla:
image: joomla:joomla
container_name: Joomla
ports:
- 900:80
command: sh -c /start.sh

Command is executed successfully and container is created. But container is also stopped immediately.
My start script is as follows:

service apache2 start

If I have a look in container logs it says that apache is started. No error wy conatiner is stopped.

If I use this container with entrypoint /bin/bash and start apache manually everything works fine.

Do you have any ideas?

Best regards
Steve

The docker container only runs as long a process is using the main terminal. If your container starts a process in the background and leaves the main terminal process unused docker assumes the container is done and stops it.

How can I solve this?

I don’t know how apache / joomla work but you need to find a command that starts apache in the foreground and not as a background service.
/etc/init.d/apache2 start might do the trick, I don’t know.

I tried i, but container is still stopping
I also added /bin/bash to start script