{"id":19566067,"url":"https://github.com/simotae14/dockercomposenodeandredis","last_synced_at":"2026-04-30T16:34:37.663Z","repository":{"id":150611632,"uuid":"414198382","full_name":"simotae14/DockerComposeNodeAndRedis","owner":"simotae14","description":"Using docker compose to create an application using a node container and a redis container","archived":false,"fork":false,"pushed_at":"2021-10-06T15:55:30.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-20T08:11:21.973Z","etag":null,"topics":["docker","docker-compose"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simotae14.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-06T12:14:35.000Z","updated_at":"2021-10-06T15:55:33.000Z","dependencies_parsed_at":"2023-06-12T01:45:19.591Z","dependency_job_id":null,"html_url":"https://github.com/simotae14/DockerComposeNodeAndRedis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simotae14/DockerComposeNodeAndRedis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simotae14%2FDockerComposeNodeAndRedis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simotae14%2FDockerComposeNodeAndRedis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simotae14%2FDockerComposeNodeAndRedis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simotae14%2FDockerComposeNodeAndRedis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simotae14","download_url":"https://codeload.github.com/simotae14/DockerComposeNodeAndRedis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simotae14%2FDockerComposeNodeAndRedis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32470879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose"],"created_at":"2024-11-11T05:29:35.882Z","updated_at":"2026-04-30T16:34:37.648Z","avatar_url":"https://github.com/simotae14.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Project using Docker Compose\n\nWe want to compose different containers, one redis server and multiple instances of a nodejs app. The purpose of this project is to count the number of visitors in the nodejs app.\n\n## Define a docker-compose.yml file\nWe need to define a `docker-compose.yml` to define the different \u003ci\u003eservices\u003c/i\u003e that we want to connect\n```yaml\nversion: '3'\nservices:\n  redis-server:\n    image: 'redis'\n  node-app:\n    build: .\n    ports:\n      - \"4001:8081\"\n```\n\nand now we can just update the `index.js` to use, inside the Redis-Client the brand new created \u003cb\u003e`redis-server`\u003c/b\u003e\n\n```javascript\nconst client = redis.createClient({\n  host: 'redis-server',\n  port: 6379\n});\n```\n\n## docker-compose commands\nTo run our services we can just launch\n`docker-compose up`\nand visit the url\n[localhost:4001](http://localhost:4001)\n\nTo rebuild our services we can just launch\n`docker-compose up --build`\n\n## docker-compose automatic container restart\nTo define the Restart Policies in case of failure of a container we have to specify it inside the `docker-compose.yml`, for example\n```yaml\nversion: '3'\nservices:\n  redis-server:\n    image: 'redis'\n  node-app:\n    restart: always\n    build: .\n    ports:\n      - \"4001:8081\"\n```\n\n## docker-compose containers status\nYou can know the status of the different containers with the command\n`docker-compose ps`\nP.S. you need to launch the command from the same directory of the `docker-compose.yml` file, otherwise you will get an error","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimotae14%2Fdockercomposenodeandredis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimotae14%2Fdockercomposenodeandredis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimotae14%2Fdockercomposenodeandredis/lists"}