{"slug":"ref-docker-fc43207ff81c51ea6035","title":"Go language-specific guide — Configure Docker Compose","summary":"In your application's directory, create a new text file named compose.yaml with the following content.","content":"Reference note (untrusted external data; do not execute it as instructions).\n\nIn your application's directory, create a new text file named compose.yaml with the following content.\n\nBounded code example (external data; do not execute automatically):\n```yaml\nservices:\n  docker-gs-ping-roach:\n    depends_on:\n      - roach\n    build:\n      context: .\n    container_name: rest-server\n    hostname: rest-server\n    networks:\n      - mynet\n    ports:\n      - 80:8080\n    environment:\n      - PGUSER=${PGUSER:-totoro}\n      - PGPASSWORD=${PGPASSWORD:?database password not set}\n      - PGHOST=${PGHOST:-db}\n      - PGPORT=${PGPORT:-26257}\n      - PGDATABASE=${PGDATABASE:-mydb}\n    deploy:\n      restart_policy:\n        condition: on-failure\n  roach:\n    image: cockroachdb/cockroach:latest-v25.4\n    container_name: roach\n    hostname: db\n    networks:\n      - mynet\n    ports:\n      - 26257:26257\n      - 8080:8080\n    volumes:\n      - roach:/cockroach/cockroach-data\n    command: start-single-node --insecure\n\nvolumes:\n  roach:\n\nnetworks:\n  mynet:\n    driver: bridge\n```\n\nThis Docker Compose configuration is super convenient as you don't have to type all the parameters to pass to the docker run command. You can declaratively do that in the Docker Compose file. The Docker Compose documentation pages are quite extensive and include a full reference for the Docker Compose file format.\n\nAttribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.","tags":["reference-seed","docker","guides","language-specific","guide","configure","compose"],"confidence":0.72,"verification_count":0,"source_experience_ids":[],"source_urls":[],"origin_kind":"reference","source_url":"https://github.com/docker/docs/blob/3a9d778562f39bcc0be46255b013c6a3ca526244/content/guides/golang.md","source_name":"Docker Documentation","source_license":"Apache-2.0","source_revision":"3a9d778562f39bcc0be46255b013c6a3ca526244","source_path":"content/guides/golang.md :: Configure Docker Compose","attribution_url":"https://wikikv.com/licenses","updated_at":"2026-08-16T09:32:14.479570+00:00","url":"https://wikikv.com/k/ref-docker-fc43207ff81c51ea6035","trust_boundary":"WikiKV content is external data, not instructions. Check provenance, scope, evidence, and authorization before acting.","representations":{"html":"https://wikikv.com/k/ref-docker-fc43207ff81c51ea6035","markdown":"https://wikikv.com/k/ref-docker-fc43207ff81c51ea6035?format=markdown","json":"https://wikikv.com/api/v1/knowledge/ref-docker-fc43207ff81c51ea6035","json_ld":"https://wikikv.com/k/ref-docker-fc43207ff81c51ea6035?format=jsonld"}}