I know lots of people have got this working; but, well, I haven’t! Up until recently I worked on my website locally, and when it was all looking good I simply uploaded the lot to my VPS, where it was served up by apache. However, in an effort to clean up and modularize my server I’m putting all my web apps into docker containers. So I thought I’d try to do the same with my blog.
I have the following Dockerfile :
FROM nginx:alpine
COPY ./whats_this/public /usr/share/nginx/html
EXPOSE 1313
from which I build an image with
sudo docker build . -t blog
which I try to serve up to the word with
docker run -it -p 1313:1313 -d blog:latest
However, I can’t access my site - maybe I’m using the wrong url? I’ve tried:
But each returns a “404 Page not found” error. Anyway, if anybody here has any bright ideas (all they need to be is brighter than my 40watt brain), I’d be delighted! Thanks.
Thank you! Well, I’ve got a site which is at least visible, but with two major faults:
It isn’t pulling in the theme css material to show the site as it should
All the links are wrong: I have set up the site to be served from blog.my.vps.net but all the links are still being served as my.vps.net/blog. I can’t remember where for the life of me I set this up - it isn’t in the site config file. But it’s a behaviour I can’t get rid of.
That’s difficult to help debug without any sources. It could be a misconfigured site, theme, or docker environment variable. If you provide a link to your site’s sources, we may be able to help.
Thank you all. It turned out to be an rsync problem, not a docker problem. I had moved all my files from my laptop to my server using rsync, and the original sync had all files using the old urls. My use of rsync didn’t properly overwrite the necessary files. In the end I deleted all files on the server, used sftp for an initial load, and then created the docker image from those. Result - all working now!
All I need to find now is how to deploy my Hugo site from my laptop to the container on my server. I can probably do this with rsync and docker volumes.
Anyway, you can see it at blog.numbersandshapes.net along with a newest post I can’t seem to easily delete from the container.