Skip to content

Instantly share code, notes, and snippets.

View mcastellin's full-sized avatar

Manuel Castellin mcastellin

View GitHub Profile
@mcastellin
mcastellin / docker-client-proxy_.docker_config.json
Last active June 7, 2023 03:12
Systemd and Docker client configurations to specify proxy settings on Docker Engine and Docker Client
// A Docker client configuration file to automatically set proxy variables
// on every new container started by the $USER.
// This configuration file should be placed in the user's home
// $HOME/.docker/config.json
{
"proxies": {
"default": {
"httpProxy": "http://10.0.1.10:3128",
"httpsProxy": "http://10.0.1.10:3128",
@mcastellin
mcastellin / .bashrc-docker-custom-format
Last active July 24, 2020 16:25
Docker ps with custom output formatting
##
# Include this snippet in your .bashrc or .zshrc file to print a prettier table
# to list Docker containers
## Use this alias definition to list Docker containers with the defined custom format
alias dps="docker ps --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.Status}}\t{{.Names}}'"
## Use this function override to apply a custom format when listing containers with "docker ps" command
function docker() {
if [ $1 == "ps" ]; then
@mcastellin
mcastellin / mysql-docker.sh
Created March 5, 2019 16:16 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE