In this guide, we will show you how to setup Code2 locally using Docker.
You need to have Docker installed on your local machine. Open your terminal and run command
docker network create icb to create a network. Database and web application containers need to be on the same network to communicate with each other.
Up-to-date images for database and web app are available on Docker Hub. Create this
docker-compose.yml file given below on your local machine. On terminal, go to directory containing this docker compose file and run
docker-compose up -d command. Restoring the database takes some time. So, web app container will restart a few times until database is ready (you can see it by running
docker logs -f web). That's it, iCodeBetter will be running on localhost:8080.
docker-compose.ymlversion: "3.4"services:db:image: icodebetter/db_packagecontainer_name: dbports:- "6666:5432"restart: on-failurevolumes:- "dbdata:/var/lib/postgresql/data"networks:- icbweb:image: icodebetter/graal_imagecontainer_name: webports:- "8080:8080"restart: on-failuredepends_on:- dbnetworks:- icbnetworks:icb:external: truevolumes:dbdata:name: dbdata
Database may not be up-to-date. So, when you follow steps given above, you can encounter missing table error. Do the following to solve the problem.
Keep db container running. Delete web container and restart it with
docker container kill webdocker container prune -fdocker run -d -p 8080:8080 --network=icb --name=web icodebetter/graal_image project=1