My development web container uses the php: 7.1-apache image. To make it easier to memorize the address of the applications contained in this container, I like to edit the Hosts file on my machine and point it this way:
127.0.0.1 site.dev
However, recently I had difficulties with this approach, it seems that browsers have recently forced HTTPS, that is, I am redirected and consequently I fall into a browser error page since SSL is not configured on the server apache that runs in the container.
Any solution to this, other than setting up SSL?
The host system that runs the container is a Mac OS (last stable release)
Follow the data to mount the container:
docker-compose.yaml
version: "3.3"
services:
mysql:
container_name: mysql
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: senha_root
MYSQL_DATABASE: banco
MYSQL_USER: root
MYSQL_PASSWORD: senha_user
command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
volumes:
- ./mysql/tmp:/var/lib/mysql
restart: on-failure
ports:
- 3306:3306
web:
container_name: web
image: web_dev
build:
context: .
dockerfile: Dockerfile-web
volumes:
- ./projetos/:/var/www
- ./apache/:/etc/apache2/sites-enabled/
working_dir: /var/www
depends_on:
- mysql
links:
- mysql
restart: on-failure #always
ports:
- 80:80
- 3000:3000
- 3001:3001
Dockerfile
FROM php:7.1-apache
MAINTAINER Fabio J L Ferreira <[email protected]>
RUN apt-get update; \
a2enmod rewrite; \
apt-get install -y curl unzip git npm libpng-dev; \
curl -sL https://deb.nodesource.com/setup_8.x | bash -; \
apt-get install -y nodejs; \
echo "America/Sao_Paulo" > /etc/timezone; \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
# Install PHP "gd" extension
# RUN apt-get install -y libjpeg-dev libpng12-dev
# RUN docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ && docker-php-ext-install gd
# Instala a extensão PHP "exif" => http://php.net/manual/pt_BR/intro.exif.php
# RUN apt-get install -y libexif-dev && RUN docker-php-ext-install exif
# Extensão "mysqi" e algumas "PDO" => http://php.net/manual/pt_BR/book.pdo.php
RUN apt-get install -y libpq-dev; \
docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql; \
docker-php-ext-install mysqli pdo_mysql pgsql pdo_pgsql
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*
COPY php/php.ini /usr/local/etc/php/