Docker help to set up a httpd apache server

813 views
Skip to first unread message

Lantos István

unread,
Feb 15, 2015, 12:31:58 PM2/15/15
to coreo...@googlegroups.com
I use CoreOS under Vagrant.

I downloaded the "httpd" official Docker image.

I created this folder structure:

/home/core/
                /www/
                /www/apache/
                /www/apache/Dockerfile


In my Dockerfile (as he original documentation suggest):
https://registry.hub.docker.com/_/httpd/

FROM httpd:latest
MAINTAINER xy <x...@email.com>

COPY ./public-html/ /usr/local/apache2/htdocs/
COPY ./my-httpd.conf /usr/local/apache2/conf/httpd.conf

RUN docker build -t apache-lanti .


Changing the order of the RUN and COPYs, not makes any difference.

I try to run with:

$ sudo docker build .

And this is what I got:

Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
Step 0 : FROM httpd:latest
 ---> f90095a67f5b
Step 1 : MAINTAINER
xy <x...@email.com>
---> Running in cd5b3271261e
 ---> a8d67b534d23
Removing intermediate container cd5b3271261e
Step 2 : COPY ./public-html/ /usr/local/apache2/htdocs/
INFO[0001] public-html/: no such file or directory


I tried many things, but still can't get it to work. How I can write a Dockerfile to create a container from the original image, then set up everything to run? Sometimes I've got "coreos docker returned a non-zero code: 127" messages connected with "/bin/sh -c"error message  (sorry, I can't remember). Setting up docker in CoreOS and actually use it is a so much pain for a total noob like me, instead I go with Ubuntu Server. :(( Just to create a server to serve your webdesign, PHP or Python projects in the future it's becoming so much s*ck after days of reading and trials & errors to get this thing to work, and I'm in the margin to give up. But I know it can be really good later on when I want to use my repo on production VPS, so I still try.

Rob Szumski

unread,
Feb 15, 2015, 2:20:29 PM2/15/15
to coreo...@googlegroups.com
Your directory structure (as listed) doesn’t contain /www/apache/public-html so docker is telling you that it doesn’t exist. Create that folder or modify the path to use a folder that does exist and your build should work just fine.

Lantos István

unread,
Feb 15, 2015, 3:15:45 PM2/15/15
to coreo...@googlegroups.com
Thank You! Suceeded.

So if I have my website files in the /home/core/www/apache/public-html/ folder, with the COPY command in the Dockerfile, I not copying the files from the container, I actually copying the files from my Home directory INTO the container? Same applies to the my-httpd.conf file, which in this case re-writing the /usr/local/apache2/conf/httpd.conf?

COPY ./my-httpd.conf /usr/local/apache2/conf/httpd.conf

And what is this httpd container exactly? I know it's contaning Apache, that's why I want to use it, but I think it's also containing a Linux install. I looked the inside directory structure and it looks like a full-fledged Linux operating system. There's no way in docker to run Apache, PHP, MySQL, Python or Django services without Linux virtual machines in the Docker containers? I think I have a huge misunderstanding about this technology and what is this for.

If I just want to create a simple Apache server with mod_wsgi, Python/Django, PHP + Database, maybe I using the wrong tools and Docker not for this? Maybe Docker is to install an Ubuntu server inside, then install apache, php, etc. And if I want an infrastructure with many servers, that's what Coreos + Docker are for, correct?

Can I install somehow Apache, PHP, SQL, etc. on bare-metal CoreOS, without another virtual machines inside it? Or if I just only want this, better to use pure Ubuntu Server, nothing else?
Reply all
Reply to author
Forward
0 new messages