Quantcast
Channel: Active questions tagged dockerfile - DevOps Stack Exchange
Viewing all articles
Browse latest Browse all 136

How to copy HTML files to include into nginx?

$
0
0

How do I copy an index.html file into nginx?

root@mordor:/home/nicholas/docker/nginx# root@mordor:/home/nicholas/docker/nginx# lltotal 12drwxrwxr-x 2 nicholas nicholas 4096 Nov 13 16:18 ./drwxrwxr-x 3 nicholas nicholas 4096 Nov 13 16:12 ../-rw-rw-r-- 1 nicholas nicholas   60 Nov 13 16:18 dockerfileroot@mordor:/home/nicholas/docker/nginx# root@mordor:/home/nicholas/docker/nginx# cat dockerfile FROM nginxCOPY /home/nicholas/html /usr/share/nginx/htmlroot@mordor:/home/nicholas/docker/nginx# root@mordor:/home/nicholas/docker/nginx# docker build -t some-content-nginx .Sending build context to Docker daemon  2.048kBStep 1/2 : FROM nginx ---> c39a868aad02Step 2/2 : COPY /home/nicholas/html /usr/share/nginx/htmlCOPY failed: stat /var/snap/docker/common/var-lib-docker/tmp/docker-builder726461098/home/nicholas/html: no such file or directoryroot@mordor:/home/nicholas/docker/nginx# root@mordor:/home/nicholas/docker/nginx# ls /home/nicholas/html/index.htmlroot@mordor:/home/nicholas/docker/nginx# root@mordor:/home/nicholas/docker/nginx# cat /home/nicholas/html/index.html indexhello worldnicholas@mordor:~/html$ 

I'm unclear on the source and destination, which might be complicated by docker having been installed from snap.


Looks like ansible has slightly clearer, at least for me, syntax:

  tasks:  - name: "Copying files"    copy:      src: files/{{ item }}      dest: /my/folder/    with_items:      - file.txt

or perhaps I'm doing something incorrectly.


Viewing all articles
Browse latest Browse all 136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>