I cannot access a simple Docker container running locally on my mac. I can start curl localhostfrom the container and see that the Apache page is set by default, but I cannot hit it from the browser.
I am wondering if I have a problem with VirtualBox configuration or something like that. Any help in diagnosing the problem?
Dockerfile
from ubuntu:precise
run apt-get -y update
run DEBIAN_FRONTEND=noninteractive apt-get -y install lamp-server^
run apt-get -y install vim-tiny curl wget
add ./startup.sh /usr/local/bin/startup.sh
run chmod 755 /usr/local/bin/startup.sh
add site.vhost /etc/apache2/sites-available/site
run a2ensite site
expose 80
site.vhost
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
</Directory>
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
startup.sh
#!/bin/bash
a2dissite default
apache2ctl graceful
/usr/bin/mysqld_safe &
To start ...
I will create an image with docker build -t test1 .- which seems to work fine.
On initial setup, I run docker run -d -v $(pwd)/mysql:/tmp/mysql test1 /bin/bash -c "cp -rp /var/lib/mysql/* /tmp/mysql"to install MySQL.
Then I ran docker run -i -t -v $(pwd)/mysql:/var/lib/mysql -v $(pwd)/www:/var/www -p 8080:80 test1 /bin/bashto run the actual instance.
service apache2 start, , , . curl localhost, .
, , . http://127.0.0.1:8080 80, ?