I had docker 1.7.1, I was following james turbnall the docker book . created two images (apache, jekyll) , created a jekyll container then I created apache container as well with the -P tag with EXPOSE 80 in the docker file but as i ran docker port 80 but no public port error.
then i upgraded to docker 1.8.1 but nothing changed I tried -P , -p , EXPOSE and every argument but i can't get it fixed .
My ports column when running Docker ps -a is always empty.
Dockerfile:
FROM ubuntu:14.04
MAINTAINER AbdelRhman Khaled
ENV REFRESHED_AT 2015-09-05
RUN apt-get -yqq update
RUN apt-get -yqq install apache2
VOLUME [ "/var/www/html" ]
WORKDIR /var/www/html
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www.data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR
EXPOSE 80
ENTRYPOINT [ "/usr/sbin/apache2" ]
CMD [ "-D", "FOREGROUND" ]
commands:
$ sudo docker build -t jamtur01/apache .
$ sudo docker run -d -P --volumes-from james_blog jamtur01/apache
$ sudo docker port container_ID 80
Error: No public port '80/tcp' published for aa99fef6544a