Dockerfile COPY: "lchown ... not a directory"

Trying to create this Docker file:

FROM dockerfile/ubuntu RUN apt-get update && apt-get install -y apache2 COPY proxypass.conf /etc/apache2/sites-available COPY caching.conf /etc/apache2/conf-available RUN a2ensite proxypass \ && a2enconf caching \ && a2disconf serve-cgi-bin EXPOSE 80 CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] 

The proxypass.conf and caching.conf are located in the apache directory along with the Dockerfile .

Running docker build gives this output:

 $ sudo docker build -t me/apache apache Sending build context to Docker daemon 29.7 kB Sending build context to Docker daemon Step 0 : FROM dockerfile/ubuntu ---> 77f8745ed183 Step 1 : RUN apt-get update && apt-get install -y apache2 ---> Using cache ---> d62d92d91591 Step 2 : COPY proxypass.conf /etc/apache2/sites-available 2014/10/16 09:02:32 lchown /u01/docker/devicemapper/mnt/38bcd5cca695b4e9ac9af77e0342f85dea9fb10a238f7bd5173289bb956cf5c8/rootfs/etc/apache2/sites-available/proxypass.conf: not a directory 

This is Oracle Linux 6.5 (essentially CentOS 6.5).

 $ sudo docker info Containers: 1 Images: 113 Storage Driver: devicemapper Pool Name: docker-8:2-1308404-pool Data file: /u01/docker/devicemapper/devicemapper/data Metadata file: /u01/docker/devicemapper/devicemapper/metadata Data Space Used: 4307.1 Mb Data Space Total: 102400.0 Mb Metadata Space Used: 5.5 Mb Metadata Space Total: 2048.0 Mb Execution Driver: native-0.2 Kernel Version: 2.6.32-358.23.2.el6.x86_64 Username: kgutwin Registry: [https://index.docker.io/v1/] 
+7
docker
source share
1 answer

The documentation for the Dockerfile COPY statement states:

If <dest> does not end with a trailing slash, it will be considered a regular file and the contents of <src> will be written in.

So just add / for the target directories and you can create your image:

 COPY proxypass.conf /etc/apache2/sites-available/ COPY caching.conf /etc/apache2/conf-available/ 
+30
source share

All Articles