Docker Community Forums

Share and learn in the Docker community.

Httpd 2.4 does not work! [solved]


(Dockergi) #1

I can not install Apache, I’m using docker 18.09.0 on Windows 8.1. I tried the code even on a friend’s windows 10 and I always have the same problems. I use the Kitematic shell (blue screen).
My dockfile:

FROM httpd:2.4
COPY ./htdocs/ /usr/local/apache2/htdocs/

My code:

Windows PowerShell
Copyright © 2014 Microsoft Corporation. Tutti i diritti sono riservati.
PS C:\Program Files\Docker Toolbox> cd C:\Users\mypcname\Desktop\docker
PS C:\Users\mypcname\Desktop\docker> docker build -t xxx:v1 .
Sending build context to Docker daemon 8.192kB
Step 1/3 : FROM httpd:2.4
—> 2a51bb06dc8b
Step 2/3 : EXPOSE 80
—> Running in db7fcfc2d273
Removing intermediate container db7fcfc2d273
—> 88d014d32124
Step 3/3 : COPY ./htdocs/ /usr/local/apache2/htdocs/
—> 594c115e41c6
Successfully built 594c115e41c6
Successfully tagged xxx:v1
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and director
ies added to build context will have ‘-rwxr-xr-x’ permissions. It is recommended to double check and reset permissions f
or sensitive files and directories.
PS C:\Users\mypcname\Desktop\docker> docker run -d --name xxx -P xxx
Unable to find image ‘xxx:latest’ locally
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: pull access denied for xxx, repository does not
exist or may require ‘docker login’.
See ‘C:\Program Files\Docker Toolbox\docker.exe run --help’.
PS C:\Users\mypcname\Desktop\docker> docker-machine ip
192.168.99.100
PS C:\Users\mypcname\Desktop\docker>

Where am I wrong?
thank you

Giampiero


(Bryce Ryan) #2

I’m not sure this is what’s going on, but your build instructions create an image tagged as xxx:v1, while your “docker run” command only refers to xxx, therefore the run command tries to load xxx:latest, which apparently doesn’t exist (as noted in the error message “Unable to find image ‘xxx:latest’ locally”. The docker daemon then tries to find xxx:latest on the docker hub, can’t find it, and generates the next error about pull access denied.

You could try a variant of your run command
docker run -d --name xxx -P xxx:v1
and see if that works as expected.


(Dockergi) #3

Thanks a lot!
You are really very good!
Something positive I see but if I write the following url in the browser I do not have my index.html file inside the htdocs folder.

http://192.168.99.100/

Here is the code:

Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. Tutti i diritti sono riservati.
PS C:\Program Files\Docker Toolbox> cd C:\Users\MyName\Desktop\docker
PS C:\Users\MyName\Desktop\docker> docker build -t my_apache_server:v1 .
Sending build context to Docker daemon  8.192kB
Step 1/4 : FROM httpd:2.4
 ---> 2a51bb06dc8b
Step 2/4 : LABEL Author="Nome Cognome"
 ---> Using cache
 ---> d25ba5e5376e
Step 3/4 : EXPOSE 80
 ---> Using cache
 ---> 10f6ff1c665a
Step 4/4 : COPY ./htdocs/ /usr/local/apache2/htdocs/
 ---> Using cache
 ---> 812d1a7bbae0
Successfully built 812d1a7bbae0
Successfully tagged my_apache_server:v1
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and director
ies added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions f
or sensitive files and directories.
PS C:\Users\MyName\Desktop\docker> docker run -d --name my_apache_server -P my_apache_server:v1
d1c85556d01ba542397c10bad0ddc2f53c95ae9426d0f3b6ff5b34bffc6c9918
PS C:\Users\MyName\Desktop\docker> docker-machine ip
192.168.99.100
PS C:\Users\MyName\Desktop\docker>

Problem:

Failed to reach the Connection site denied from 192.168.99.100.
Try to:
Check the connection
Check the proxy and firewall
ERR_CONNECTION_REFUSED

why is the tag sometimes put and sometimes not?
why is the following code wrong?

docker run -d --name my_apache_server:v1 -P my_apache_server:v1


(Dockergi) #4

Why do not I get an answer?
Is my question difficult?


(Dockergi) #5

I tried to delete everything, I removed all the images of docker but I still get the same problem. Why everyone can do great things with docker and I’m just sorry?
Is it a problem of the image?
Why do not you answer my question anymore?
Have you tried to install htppd?
Does it work?
Is it a problem of my computer?
Please help me! If you are not able to solve my problem I do not know who to ask.
I can not think that docker can not get Apache to work.
thank you


(Dockergi) #6

I solved. The container now works. I can not explain the reason for all these problems.
Thank you all

P.S.: Is it normal for the container to display only http files and not php files?