Misc repo for DevOps tooling
https://hub.docker.com/u/elfreako
Docker image contains
- AWK v5.0.1
- Azure CLI v2.32.0
- Bicep v0.4.1124
- Curl v7.68.0
- Git v2.25.1
- JQ v1.6
- Nano v4.8
- Packer v1.7.8
- PowerShell v7.2.1
- Shellcheck v0.8.0
- Terraform v1.1.3
- Terraform Docs v0.16.0
- UnZip v6.00
- Zsh v5.8
Run the container in detached mode and always load on boot:
docker run \
--name devtools \ # Assign a name to the container
--detach \ # Run container in background and print container ID (or -d)
--restart unless-stopped \ # Restart policy to apply when a container exits (default "no")
--tty \ # Allocate a pseudo-TTY (or -t)
--volume '/etc/localtime':/etc/localtime:ro \ # map your timezone
--volume '/etc/timezone':/etc/timezone:ro \ # map your timezone
--volume '/mnt/c/Users/asdf/asdf':/data \ # mount a volume (or -v)
--volume '/mnt/c/Users/zxcv/qwer':/data \ # mount a volume (or -v)
--volume "${HOME}/.ssh":/root/.ssh \ # map your SSH key for git pulls
elfreako/devtools
TIP: you can add your local SSH file to push/pull repos more easily by appending another volume: --volume "${HOME}/.ssh":/root/.ssh \
Connect to container via ZSH:
docker exec -it devtools /bin/zsh
# -i = Keep STDIN open even if not attached
# -t = Allocate a pseudo-TTY
Disabled Git refresh for performance gain: ohmyzsh/ohmyzsh#3288
git config --global --add oh-my-zsh.hide-info 1
Recommended usage when flipping between computers is using Settings Sync within VSCode: https://code.visualstudio.com/docs/editor/settings-sync
The Docker extension also allows you to attach the running container as a shell: https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
v1.0.0: Added /root/.vscode-server
folder to map volume locally to speed up extensions being installed/re-used. Add another volume mount: https://code.visualstudio.com/docs/remote/containers-advanced#_avoiding-extension-reinstalls-on-container-rebuild
-v "${HOME}/someFolder/.vscode-server":/root/.vscode-server
Enabling container dropdown in Windows Terminal using WSL and Docker Desktop:
Add a new profile in settings.json
under {}profiles.[]list
{
"commandline": "docker exec -it devtools /bin/zsh",
"icon": "E:\\Downloads\\asdf\\qwer\\zxcv\\clover 2.png",
"name": "Docker devtools",
"tabColor": "#B018ED",
"tabTitle": "Docker devtools"
}
Docker with WSL tends to eat up memory at times, to restrict it, perform the following...
Turn off all WSL instances including docker-desktop:
wsl --shutdown
notepad "$env:USERPROFILE/.wslconfig"
Edit .wslconfig
file with notepad, adding these settings:
[wsl2]
memory=3GB # Limits VM memory in WSL 2 up to 3GB
processors=4 # Makes the WSL 2 VM use two virtual processors
...restart WSL
To enable auto load in MacOS Terminal, edit your Preferences and create/duplicate a Profile. Under the Shell menu of the profile, add docker exec -it devtools /bin/zsh
inside the Run Command.