Table of Contents

Dockerfile and docker-compose Filetype

Dockerfile is a file format used to build Docker images.
docker-compose.yml is a file format to build and run multiple Docker containers; using docker-compose.

Docker is a computer program that performs operating-system-level virtualization, also known as “containerization”

This page describe how to add basic docker-compose file syntax highlighting to Geany.

Note: Since Geany 2.1 a filetype for Dockerfiles is included in Geany. For older versions, the filetype can be manually installed from https://github.com/geany/geany/blob/master/data/filedefs/filetypes.Dockerfile.conf.

Step 1)

Add the following lines to ~/.config/geany/filetype_extensions.conf under the respective sections [Extensions] and [Groups]

[Extensions]
DockerCompose=docker-compose*.yml;docker-compose*.yaml;compose.yml;compose.yaml
 
[Groups]
Script=DockerCompose;

Step 2)

Save the configuration file below in your Geany filetype definition files config directory, e.g. ~/.config/geany/filedefs/filetypes.DockerCompose.conf

filetypes.DockerCompose.conf
# For complete documentation of this file, please see Geany's main documentation
#
# Geany Color Syntax support for Docker-Compose files
 
# Use the Python filetype as base for better highlighting of YAML keys according to defined keywords
[styling=Python]
 
[lexer_properties=Python]
 
[keywords]
primary=aliases annotations app_protocol args attach attachable aux_addresses blkio_config build cap_add cap_drop cgroup cgroup_parent command condition configs container_name content context cpu_count cpu_percent cpu_period cpu_quota cpu_rt_period cpu_rt_runtime cpu_shares cpus cpuset credential_spec default depends_on deploy develop device_cgroup_rules device_read_bps device_read_iop device_read_iops device_write_bps device_write_iops devices disable dns dns_opt dns_search dockerfile domainname drive driver_opts enable_ipv6 entrypoint env_file environment expose extends external external_links extra_hosts file gateway gid group_add hard healthcheck host_ip hostname image init internal interval ip_range ipam ipc ipv4_address ipv6_address isolation labels link_local_ips links logging mac_address mem_limit mem_reservation mem_swappiness memswap_limit mode name network network_mode networks nofile nproc oom_kill_disable oom_score_adj options path pid pids_limit platform ports priority privileged profiles protocol published pull_policy rate read_only required restart retries runtime scale secrets security_opt service services shm_size soft source start_interval start_period stdin_open stop_grace_period stop_signal storage_opt subnet sysctls target test timeout tmpfs tty type uid ulimits user userns_mode uts version volumes volumes_from weight weight_device working_dir
identifiers=false host ingress no null service_completed_successfully service_healthy service_started true yes
 
[settings]
lexer_filetype=Python
extension=yaml
mime_type=application/x-yaml
comment_single=#
 
context_action_cmd=xdg-open "https://docs.docker.com/compose/compose-file/"