Docker host for website

I am working on developing a website. I want to host it in a docker container. I am new to docker and it’s components. I will be running this on CentOS 7. I want to build a custom image will serve to be the website host. I am not sure what components are needed from the linux side or the container side. One of my other major focuses is on security.

I think this will be a fun project into learning docker and how docker can be leveraged to handle day to day task. Any help is greatly appreciated. Please let me know if there is anything I missed for designing a robust and secure hosting solution.

Well, typically if you’re running to CE (community edition), you will want the latest image.

The ones hosted in via the centos maintainers are too old, so you will need to add the repo yourself. Be sure to follow the instructions.

As far as the image to use this will depend on what language you want to develop in. For example, I am running my website in a nodejs container on a digital ocean droplet.

.dockerignore

node_modules
npm-debug.log

Dockerfile

FROM node:alpine
ENV NODE_ENV production
ENV PORT 8080
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 8080
CMD ["npm", "start"]
3 Likes