{"id":21019063,"url":"https://github.com/paalamugan/docker-compose-configuration","last_synced_at":"2026-05-16T06:36:24.712Z","repository":{"id":45861492,"uuid":"443065259","full_name":"paalamugan/docker-compose-configuration","owner":"paalamugan","description":"Configuration of multiple docker-compose.yml service file examples.","archived":false,"fork":false,"pushed_at":"2022-07-17T18:37:08.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-10T02:25:46.010Z","etag":null,"topics":["docker","docker-compose","docker-setup","dockerfile"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/paalamugan.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}},"created_at":"2021-12-30T12:14:38.000Z","updated_at":"2022-05-01T14:53:40.000Z","dependencies_parsed_at":"2022-09-01T20:24:04.153Z","dependency_job_id":null,"html_url":"https://github.com/paalamugan/docker-compose-configuration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paalamugan/docker-compose-configuration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paalamugan%2Fdocker-compose-configuration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paalamugan%2Fdocker-compose-configuration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paalamugan%2Fdocker-compose-configuration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paalamugan%2Fdocker-compose-configuration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paalamugan","download_url":"https://codeload.github.com/paalamugan/docker-compose-configuration/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paalamugan%2Fdocker-compose-configuration/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33092717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","docker-setup","dockerfile"],"created_at":"2024-11-19T10:28:52.392Z","updated_at":"2026-05-16T06:36:24.696Z","avatar_url":"https://github.com/paalamugan.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Compose Configuration\n\nConfiguration of multiple docker-compose.yml service file examples.\n\n## How to install docker compose\n\n- Download the docker-compose file\n\n```sh\nsudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose\n```\n\n- Add executable permission to the file.\n\n```sh\nsudo chmod +x /usr/local/bin/docker-compose\n```\n\n- Test installation results.\n\n```sh\ndocker-compose --version\n```\n\n## [Dockerfile instructions](https://docs.docker.com/engine/reference/builder/)\n\nBefore understanding Docker compose, you need to understand Dockerfile.\n\n### FROM\nSpecify the base image, usually the first instruction of the file, but in fact, you can also use ARG as the first instruction.\n\n```\n  # Format\n   FROM [--platform=\u003cplatform\u003e] \u003cimage\u003e [AS \u003cname\u003e]  \n   FROM [--platform=\u003cplatform\u003e] \u003cimage\u003e[:\u003ctag\u003e] [AS \u003cname\u003e] \n   FROM [--platform=\u003cplatform\u003e] \u003cimage\u003e[@\u003cdigest\u003e] [AS \u003cname\u003e]\n\n  # Usage\n   FROM ubuntu\n   FROM openjdk:8-jre\n   FROM node:12.18.4-alpine@sha256:757574c5a2...\n```\n**Parameter Description:**\n   - `[--platform=\u003cplatform\u003e]` is an optional parameter, which can be used to specify the platform of the image, such as Linux/amd64, Linux/arm64, or windows/amd64, usually the default.\n   - `\u003cimage\u003e` is the image name, followed by `:tag` is the version number used to specify the image, and `@digest` is the content-addressable identifier (you can go to the official website for details). Generally, we only use tags. If two If neither is specified, the latest version is obtained\n   - `[AS \u003cname\u003e]` is the name of the current build stage, because multiple FROMs can be used in the Dockerfile to create multiple images, so using as `\u003cname\u003e` can be used in the following COPY command, use `--from=\u003cname\u003e` to refer to the image built earlier, such as copying the files generated by the previous image, etc.\n\n### ARG\nThis command is used to specify a variable that is passed to the build runtime. It can set a default value. When building a container with the `docker build` command, use `--build-arg \u003cvarname\u003e=\u003cvalue\u003e` to pass parameters.\n\n```\n# Format\nARG \u003cname\u003e[=\u003cdefault value\u003e]\n\n# Usage\nARG CODE_VERSION=laster\nARG testArg=123\n\n# Parameter\nFROM centos:7\nARG parameter=123\nRUN echo $parameter\n\ndocker build --build-arg parameter=234 -t test:1.0\n\n# Note\n# ARG can be used before FROM, outside of the FROM build phase, so it cannot be used in any instructions after FROM.\nARG UBUNTU_VERSION=laster\nFROM ubuntu:${UBUNTU_VERSION}\n```\n\n### ENV\nThis command is used to set environment variables for the container, both during the build process and in the launched container.\n\n```\n# Format\nENV \u003ckey\u003e=\u003cvalue\u003e ...\n\n# Note\n# More than one can be set, or another syntax ENV \u003ckey\u003e \u003cvalue\u003e can be used. The official website recommends using the former, and the latter may be deleted in future versions.\n# ENV variables override ARG variables\n\n# Usage\nENV APP_VERSION=1.1.0\nENV WEB_HOME /opt/webapps\n```\n\n### COPY\nThis command is used to copy files or directories from the path to the container.\n\n```\n# Format\nCOPY \u003csrc\u003e... \u003cdest\u003e\nCOPY \"\u003csrc\u003e\",... \"\u003cdest\u003e\"\n\n# Usage\nCOPY test.js /opt/web/\n```\n\n### ADD\nThis command is used to copy files, directories, or remote files to the image, and the tar-type compressed package file will be automatically decompressed.\n\n```\n# Format\nADD \u003csrc\u003e... \u003cdest\u003e\nADD \"\u003csrc\u003e\",... \"\u003cdest\u003e\"\n\n# Usage\nADD test.txt /tmp/test\n```\n\n### WORKDIR\nThis command sets the working directory for subsequent directives, if it does not exist, the directory will be created automatically.\n\n```\n# Format\nWORKDIR /path/to/workdir\n\n# Usage\nWORKDIR /build\n```\n\n### LABEL \nThis command is used to specify the metadata tag information of the image.\n\n```\n# Format\nLABEL \u003ckey\u003e=\u003cvalue\u003e \u003ckey\u003e=\u003cvalue\u003e \u003ckey\u003e=\u003cvalue\u003e ...\n\n# Usage\nLABEL version=\"1.0\"\nLABEL description=\"This text illustrates\"\n```\n\n### CMD\nThis command is used to set the command to be executed when the container starts after building the image.\n\n```\n# Format\nCMD [\"executable\",\"param1\",\"param2\"]\nCMD [\"param1\",\"param2\"]\nCMD command param1 param2\n\n# Usage\nCMD sleep 40; node server.js\nCMD [\"node\", \"server.js\"]\n```\n\n### RUN\nThis command is used to specify the command to be executed when building the image. The main difference between RUN and CMD is that CMD is executed when the container starts, while RUN is executed during the container construction.\n\n```\n# Format\nRUN \u003ccommand\u003e\nRUN [\"executable\", \"param1\", \"param2\"]\n\n# Usage\nRUN apt install -y net-tools\nRUN [\"/bin/bash\", \"-c\", \"echo helloworld\"]\n```\n\n### EXPOSE\nThis command is used to specify that the container is running on the specified port. You can specify the listening protocol. If not specified, the default is TCP.\n\n```\n# Format\nEXPOSE \u003cport\u003e [\u003cport\u003e/\u003cprotocol\u003e...]\n\n# Usage\nEXPOSE 80/udp\nEXPOSE 80 443\n```\n\n### VOLUME\nThis command is used to create a mount point with the specified name that can map the directory outside the container.\n\n```\n# Format\nVOLUME [\"/data\"]\n\n# Usage\nVOLUME /myvol\n```\n\n## [Docker common commands](https://docs.docker.com/engine/reference/commandline/docker/)\n\n- build: Build container.\n- ps: List all containers of the current project.\n- up: Build the container and start the container, common parameters: -d background start, - specify the configuration file.\n- exec: Into the specified container.\n- top: View the running status of each container in the project.\n- logs: View the output of the container.\n- down: Stop and remove all containers and remove the corresponding network.\n- rm: Remove all stalled containers.\n- start/stop/restart: Start container/stop container/restart container.\n\n## [Docker compose file structure](https://docs.docker.com/compose/compose-file/)\n\n- version: Specify the compsoe version corresponding to the current file, mainly 1, 2.x and 3.x\n- services: service list\n   - [service-name]: service name\n     - image: Specify the running image, you can directly pull the existing image for processing\n     - build: Set the folder where the Dockerfile is located, which can process images that need to be built with Dockerfile\n       - content: the path to store the Dockerfile\n       - dockerfile: Specifies the Dockerfile filename for the build\n       - args: build arguments, only accessible during the build process\n     - container_name: set the container name\n     - restart: restart strategy, there are no, always, no-failure, unless-stoped\n     - ports: Expose the port of the container, the format is host port: container port\n       - 8080:8080\n     - hostname: set the hostname of the container\n     - volumes: Set the mount point of the container, which can be mounted on the host, the main format is `\"host path\":\"container path\"[: \"access mode(w,r,rw)\"]`\n       - /opt/data:/opt/data\n       - /var/lib/mysql:/var/lib/mysql:rw\n     - volumes_from: mount all data volumes of another service or container\n       - service_name\n       - container_name\n     - environment: set environment variables\n       - RACK_ENV=development\n- networks: configure networks\n  - app_netwotk:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaalamugan%2Fdocker-compose-configuration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaalamugan%2Fdocker-compose-configuration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaalamugan%2Fdocker-compose-configuration/lists"}