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.

  1. locate hosts file.
    • linux: /etc/hosts
    • macos: /private/etc/hosts
    • windows: c:\windows\system32\drivers\etc\hosts
  2. add line @ end of file:

    127.0.0.1 myapp.dev 

now can access container using myapp.dev:8080.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -