Docker Community Forums

Share and learn in the Docker community.

Image from base image


(Swethavisalam) #1

Hi,
I am building a php and sql application using xampp. Therefore I pulled the base image for Xampp from docker hub:docker run -t -i -p 8080:80 garland/xampp-base /bin/bash.
I edited the image by creating a sql database and connecting a php code in htdocs. The program runs fine but when i commit the changes using docker commit newimage the container is getting committed successfully and is listed in docker images.
Then when i run the committed image using docker run -p 8080:80 -d newimage the container is getting exited and cannot be viewed in docker ps but can be viewed in docker ps -a and the status says “Exited”. Can anybody help me around it please.
Thanks!!


(Martin Terp) #2

you can use “docker logs INSTANCEID” to check whats going on, it could just be a conf error.
But a quick guess could be due to the entrypoint.

When using commit, try and use:
docker commit -c ‘ENTRYPOINT ["/bin/bash"]’ newimage


(Swethavisalam) #3

Thank you for your response. I am still new to docker so I dont get what you are saying. Yet I tried the command “docker log instanceid” which shows my php code. then i tried the docker commit -c but it shows error. Can you tell me how to proceed pls…I HAVE ATTACHED MY TERMINAL HERE. Garland/xampp-base is the base image i have used and modified. “swe” was the new-image name .

please do help me…


(Martin Terp) #4

Hi again.

Try and rerun the last command you have in your terminal screenshot, but add a space between ENTRYPOINT and [.
like: ENTRYPOINT ["/bin/bash"].

Also note, that it should work just to start your new image with: docker run -t -i -p 8080:80 swe /bin/bash


(Swethavisalam) #5

Thanks a lot terpz… It worked perfectly…and the container is committed good and is viewed on web also… thank you for the guidance.