Is it possible to have a custom url for a docker container? -
i have following dockerfile , wondering need in order access host machine visiting myapp.dev:
from ubuntu:16.04 user root run apt-get update && apt-get -y upgrade && apt-get install apt-utils -y && debian_frontend=noninteractive apt-get -y install \ apache2 php7.0 php7.0-mysql libapache2-mod-php7.0 curl lynx-cur git expose 80 add www /var/www/site run echo "servername localhost" >> /etc/apache2/apache2.conf cmd /usr/sbin/apache2ctl -d foreground expose 80 i using following command run container:
docker run -d -p 8080:80
if want able resolve locally add alias localhost in hosts file.
- locate
hostsfile.- linux:
/etc/hosts - macos:
/private/etc/hosts - windows:
c:\windows\system32\drivers\etc\hosts
- linux:
add line @ end of file:
127.0.0.1 myapp.dev
now can access container using myapp.dev:8080.
Comments
Post a Comment