Docker Community Forums

Share and learn in the Docker community.

Building docker image


(Rafiqul) #1

Hi
I am trying to build an image that will run multiple processes in a container, specifically postgres and apache. Could you please help figuring out it?

Dockerfile


FROM ubuntu
MAINTAINER rafiqul@telenordigital.com
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
RUN echo “deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main” > /etc/apt/sources.list.d/pgdg.list
RUN apt-get update && apt-get install -y python-software-properties software-properties-common postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 apache2 supervisor
RUN mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
USER postgres
RUN /etc/init.d/postgresql start &&\ psql --command “CREATE USER docker WITH SUPERUSER PASSWORD ‘docker’;” &&\ createdb -O docker docker
RUN echo “host all all 0.0.0.0/0 md5” >> /etc/postgresql/9.3/main/pg_hba.conf
RUN echo “listen_addresses=’*’” >> /etc/postgresql/9.3/main/postgresql.conf
EXPOSE 80 5432
VOLUME ["/etc/postgresql", “/var/log/postgresql”, “/var/lib/postgresql”]
CMD [”/usr/bin/supervisord"]

supervisord.conf


[supervisord]
nodaemon=true

[program:postgresql-9.3]
command="/usr/lib/postgresql/9.3/bin/postgres", “-D”, “/var/lib/postgresql/9.3/main”, “-c”, “config_file=/etc/postgresql/9.3/main/postgresql.conf”

[program:apache2]
command=/bin/bash -c “source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND”

Error while I ran the ‘docker build -t=“db-web” .’ command


Post http:///var/run/docker.sock/v1.20/build?cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=db-web&ulimits=null: dial unix /var/run/docker.sock: permission denied.

  • Are you trying to connect to a TLS-enabled daemon without TLS?
  • Is your docker daemon up and running?

(Sebastiaan van Steenis) #2

Hi @rafiqul, at first this doesn’t seem to be an issue with your Dockerfile just that you cannot connect to the Docker daemon. Did you add yourself to the docker group or tried running it with sudo? Is the daemon running?


(Rafiqul) #3

Supersb, thank you for your reply with guide. I went through. But I have found some red-marked message!! Could you please help giving clue about those messages. Below is the llink.

Thanks again.

https://drive.google.com/file/d/0BwLvvv_MolaQajB5UnhoeVVmZlE/view?usp=sharing