Skip to content

Instantly share code, notes, and snippets.

@malkab
Last active September 15, 2022 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malkab/d3b2ca5ccf4787e3d989b600c0a6c9b5 to your computer and use it in GitHub Desktop.
Save malkab/d3b2ca5ccf4787e3d989b600c0a6c9b5 to your computer and use it in GitHub Desktop.
Docker Recipes
version: '3.5'
networks:
carto_bcn:
external: false
name: carto_bcn
attachable: true
services:
postgis:
image: malkab/postgis:holistic_hornet
container_name: carto_bcn
networks:
- carto_bcn
ports:
- "5432:5432"
volumes:
- ./docker_persistent_volumes/pg:/data
version: '3.5'
networks:
sunnsaas:
external: false
name: ${MLKC_SUNNSAAS_APP_NAME}
attachable: true
volumes:
phd-data-postgis:
external: false
name: phd-data-postgis
services:
postgis:
image: malkab/postgis:gargantuan_giraffe
container_name: sunnsaas_postgis_v1
environment:
- PASSWORD=${MLKC_SUNNSAAS_DB_PASSWORD}
networks:
- sunnsaas
ports:
- "${MLKC_SUNNSAAS_DB_OUTER_PORT}:5432"
volumes:
- ./000_localhost_volumes/sunnsaas_postgis:/data
- ../../assets/pg/postgresql.conf:/default_confs/postgresql.conf
- phd-data-postgis:/whatever
version: '3.5'
networks:
cell_raw_data:
name: cell_raw_data_holistic_hornet
external: false
attachable: true
configs:
pg_hba_conf:
file: ./configs/pg_hba.conf
postgresql_conf:
file: ./configs/postgresql.conf
volumes:
cell_raw_data_postgis:
external: false
name: cell_raw_data_postgis_holistic_hornet
services:
cell_raw_data_postgis:
image: malkab/postgis:holistic_hornet
shm_size: "20GB"
environment:
- PASSWORD=jju3kn3332bgb4@hh
networks:
- cell_raw_data
ports:
- "5643:5432"
tmpfs:
- /tmp:size=20GB
volumes:
- cell_raw_data_postgis:/data
- type: tmpfs
target: /dev/shm
configs:
- source: pg_hba_conf
target: /default_confs/pg_hba.conf
uid: '1000'
gid: '1000'
mode: 0644
- source: postgresql_conf
target: /default_confs/postgresql.conf
uid: '1000'
gid: '1000'
mode: 0644

Docker Recipes

Some Docker recipes.

GitLab and Docker Registry Tokens

GitLab provides access tokens at various access levels, like API or Read Registry ones. To use them:

# Expliciting the token as password
docker login registry.gitlab.com -u user -p pass

# Without expliciting it (interactive mode)
docker login registry.gitlab.com -u user

After login, push and pulls of images from GitLab registries become available.

Removing Images Selectively

Filtering images to remove:

# Remove dangling images
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)

# Find images with a tag
docker images | grep 1.3.1
# Get their hashes
docker images | grep 1.3.1 | tr -s ' ' | cut -d ' ' -f 3
# Remove when very sure
docker rmi $(docker images | grep 1.3.1 | tr -s ' ' | cut -d ' ' -f 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment