Docker tips and tricks: Difference between revisions
m (Text replacement - "<source" to "<syntaxhighlight") |
|||
Line 1: | Line 1: | ||
== Using docker behind a proxy == | == Using docker behind a proxy == | ||
< | <syntaxhighlight lang=bash> | ||
# systemctl edit docker.service | # systemctl edit docker.service | ||
</source> | </source> | ||
Enter the next three lines and save: | Enter the next three lines and save: | ||
< | <syntaxhighlight lang=ini> | ||
[Service] | [Service] | ||
Environment="HTTP_PROXY=user:pass@proxy:port" | Environment="HTTP_PROXY=user:pass@proxy:port" | ||
Line 12: | Line 12: | ||
Restart docker: | Restart docker: | ||
< | <syntaxhighlight lang=bash> | ||
# systemctl restart docker.service | # systemctl restart docker.service | ||
</source> | </source> | ||
Line 18: | Line 18: | ||
== Some useful aliases == | == Some useful aliases == | ||
I put this in my ~/.bash_aliases to maintain a check_mk container: | I put this in my ~/.bash_aliases to maintain a check_mk container: | ||
< | <syntaxhighlight lang=bash> | ||
alias omd-log='docker container logs monitoring' | alias omd-log='docker container logs monitoring' | ||
alias omd-recreate-volume='docker volume create --driver local --opt type=nfs --opt o=addr=nfs.server.tld,rw --opt device=:/share monitoring' | alias omd-recreate-volume='docker volume create --driver local --opt type=nfs --opt o=addr=nfs.server.tld,rw --opt device=:/share monitoring' |
Revision as of 16:51, 25 November 2021
Using docker behind a proxy
<syntaxhighlight lang=bash>
- systemctl edit docker.service
</source> Enter the next three lines and save: <syntaxhighlight lang=ini> [Service] Environment="HTTP_PROXY=user:pass@proxy:port" Environment="HTTPS_PROXY=user:pass@proxy:port" </source>
Restart docker: <syntaxhighlight lang=bash>
- systemctl restart docker.service
</source>
Some useful aliases
I put this in my ~/.bash_aliases to maintain a check_mk container: <syntaxhighlight lang=bash> alias omd-log='docker container logs monitoring' alias omd-recreate-volume='docker volume create --driver local --opt type=nfs --opt o=addr=nfs.server.tld,rw --opt device=:/share monitoring' alias omd-root='docker container exec -it $(docker ps --filter name=monitoring -q) /bin/bash' alias omd-cmk='docker container exec -it -u omd monitoring bash' alias omd-start='docker container run --rm -dit -p 8080:5000 --tmpfs /omd/sites/omd/tmp:uid=1000,gid=1000 --ulimit nofile=1024 -v monitoring:/omd/sites --name monitoring -e CMK_SITE_ID=omd -e MAIL_RELAY_HOST='\smtp-gw.server.tld'\ -v /etc/localtime:/etc/localtime:ro checkmk/check-mk-raw:1.6.0p12' alias omd-stop='docker stop $(docker ps --filter name=monitoring -q)' </source>