docker-compose
Learn how to use Docker Compose with this YAML configuration example. Easily define and manage multi-container applications. Free and easy to use.
Docker Compose
This example demonstrates a basic Docker Compose configuration for a Go application.
The version
specifies the Docker Compose file version. The services
section defines the application's services, in this case, a single service named go-app
. The build
directive specifies the build context, and container_name
sets the container's name. The ports
mapping exposes port 8080 on the host to port 8080 in the container. The networks
section defines a network named appnet
for the container to join. Finally, the logging driver and options are specified.
version: '3.8'
services:
go-app:
build: .
container_name: go-app
ports:
- 8080:8080
networks:
- appnet
logging:
driver: "json-file"
options:
max-size: "1m"
networks:
appnet:
name: appnet
For more information on Docker Compose, refer to the official documentation: https://docs.docker.com/compose/