Skip to content

andrikoz/todo-app

Repository files navigation

todo-app

Simple todo list application to demonstrate docker

Getting started for local development

Make sure you have the following or newer versions:

  • node: 12.22
  • npm: 7.7

Install dependencies:

$ yarn install --production

Start Application:

$ node src/index.js

Commands Reference

Build docker image:

$ docker build . -t todo-app

Get all images from local repository:

$ docker images

Run docker container:

$ docker run -dp 3000:3000 --name todo-app todo-app

Check running containers:

$ docker ps

Check running and stopped containers:

$ docker ps -a

Stop docker container:

$ docker stop todo-app

Start docker container:

$ docker start todo-app

Remove docker container:

$ docker rm todo-app

Stop and remove docker container:

$ docker rm -f todo-app

Get a bash shell into a running container:

$ docker exec -it todo-app /bin/sh

Get logs of a running container:

$ docker logs todo-app

Login to dockerhub:

$ docker login

Tag your image with your newly created repo:

$ docker tag todo-app <my-dockerhub-username>/todo-app:latest

Push image to dockerhub:

$ docker push andrikoz/todo-app:latest

Create a docker volume:

$ docker volume create todo-db

Delete a docker volume:

$ docker volume rm todo-db

Check docker volumes:

$ docker volume ls

Use docker volume with todo-app container:

$ docker run -dp 3000:3000 -v todo-db:/tmp/todos --name todo-app todo-app

Start applications with docker-compose:

$ docker-compose up -d

Optimized Dockerfile:

FROM node:12-alpine
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --production
COPY . .
CMD ["node", "src/index.js"]

Links

Docker Playground 12factor app

About

Sample todo application to demonstrate docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published