skip to Main Content

I am working with docker docker on windows 10 pro. I created ubuntu container with apache, mysql,phpmyadmin. How can I run this as localhost on my pc.

Container IP – 172.17.0.5

2

Answers


  1. The answer for this could vary depending on whether you have installed docker for windows or docker toolbox. If it is the first case you can simply start the container and access them through localhost with the published port. You can run the following command to run the container and bind the ports to the host machine.

    docker run -p <host_port>:<container_port> -p <another_host_port>:<another_container_port> image_name
    

    After that access the relevant ports as localhost:host_port

    If you are using docker toolbox you need to find the docker machine ip that is being used.
    This can be obtained by docker-machine ip and access the application you want using ip:port

    Login or Signup to reply.
  2. if you want to deploy a static page use

    docker run -d -p 80:80 image_name /usr/sbin/apache2ctl -D FOREGROUND

    provided your index.php or HTML files are inside /var/www/html

    BUT IF YOU HAVE DATABASE TOO THEN YOU WILL ONLY GET THE WEB UI

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search