How to run command using docker-compose

强颜欢笑 提交于 2019-12-25 00:37:40

问题


I had a dockerfile which tried to install nginx like following:

Dockerfile

FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y expect
RUN apt-get -y install software-properties-common 
RUN apt-add-repository ppa:ondrej/php
RUN apt-get -y install php7.1 php7.1-fpm 
RUN apt-get install php7.1-mysql
RUN apt-get -y install nginx

For some reason, I tried to run dockfile inside docker-compose:

version: '3'

services:
   web:
     build: 
       context: .
       dockerfile: Dockerfile
     ports:
       - "3011:80"
     command: nginx

After I run docker-compose up, I access 127.0.0.1:3011, but nginx is not running.

Seems like nginx haven't been start. Am I doing wrong at this line?

command: nginx

来源:https://stackoverflow.com/questions/52272495/how-to-run-command-using-docker-compose

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!