php - How can I run my docker container with installed Nginx? -


i have docker image dockerfile, build docker build . command. dockerfile content is:

from ubuntu run apt-get update && apt-get install -y nginx php5 php5-fpm add . /code 

how can run docker container see nginx work?

update: when try use next dockerfile:

from ubuntu run apt-get update && apt-get install -y nginx php5 php5-fpm run sudo echo "daemon off;" >> /etc/nginx/nginx.conf cmd service php5-fpm start && nginx 

it build docker build -t my/nginx ., when enter docker run --rm -ti my/nginx command, terminal not response:

enter image description here

when build image want specify image name -t option.

docker build -t my/nginx . 

to run container use run command

docker run --rm -ti my/nginx 

you should add following command dockerfile

cmd ["nginx"] 

or php5-fpm

cmd service php5-fpm start && nginx 

update. should run nginx daemon off. add following dockerfile after installing nginx.

run echo "daemon off;" >> /etc/nginx/nginx.conf 

update2.

-ti option in run allows check log messages if any. should run container in background using -d instead of -ti. can attach running container using attach command.

you may check docker reference see how stop , remove container , other commands.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -