Upload a small development environment. There are 2 containers:
- mysql (mysql: 5.7)
- web (php: 7.1-apache)
My question is in a docker-compose.yml and Dockerfile configuration parameter, respectively:
- ports
- EXPOSE
What's the difference between them?
docker-compose.yml
version: "3.3"
services:
mysql:
container_name: mysql
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: SENHA_AQUI
MYSQL_DATABASE: webapp
MYSQL_USER: root
MYSQL_PASSWORD: senha_aqui
restart: always
ports:
- 3306:3306
web:
container_name: web
image: web_dev
build:
context: .
dockerfile: Dockerfile
volumes:
- ./htdocs/:/var/www
- ./apache/:/etc/apache2/sites-available/
working_dir: /var/www
depends_on:
- mysql
links:
- mysql
restart: always
ports:
- 80:80
I solved sub
Dockerfile:
FROM php:7.1-apache
MAINTAINER Fabio J L Ferreira <[email protected]>
RUN apt-get update && apt-get install -y curl unzip git npm && curl -sL https://deb.nodesource.com/setup_6.x | bash - && apt-get install -y nodejs
COPY php.ini /usr/local/etc/php/
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
RUN rm -rf /var/lib/apt/lists/* /tmp/*