Docker on Windows: Difference between revisions
Jump to navigation
Jump to search
Line 214: | Line 214: | ||
{| | {| | ||
| valign="top" | | | valign="top" | | ||
* [https://docs.docker.com/docker-for-windows/install-windows-home Install Docker Desktop on Windows Home] | * [https://docs.docker.com/docker-for-windows/install-windows-home Install Docker Desktop on Windows Home] | ||
* [https://docs.microsoft.com/en-us/windows/wsl/install-win10 Windows Subsystem for Linux Installation] | * [https://docs.microsoft.com/en-us/windows/wsl/install-win10 Windows Subsystem for Linux Installation] | ||
Line 220: | Line 219: | ||
* [https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel Updating the WSL-2 Linux kernel] | * [https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel Updating the WSL-2 Linux kernel] | ||
* [https://docs.docker.com/docker-for-windows/wsl/ Docker Desktop WSL-2 backend] | * [https://docs.docker.com/docker-for-windows/wsl/ Docker Desktop WSL-2 backend] | ||
* [https://hub.docker.com/editions/community/docker-ce-desktop-windows/ Docker Desktop for Windows] | * [https://hub.docker.com/editions/community/docker-ce-desktop-windows/ Docker Desktop for Windows] | ||
* [https://docs.microsoft.com/en-us/windows/wsl/compare-versions Comparing WSL-1 vs WSL-2] | * [https://docs.microsoft.com/en-us/windows/wsl/compare-versions Comparing WSL-1 vs WSL-2] | ||
* [https://docs.microsoft.com/en-us/virtualization/windowscontainers/container-networking/architecture Windows container networking] | * [https://docs.microsoft.com/en-us/virtualization/windowscontainers/container-networking/architecture Windows container networking] | ||
| valign="top" | | | valign="top" | | ||
Line 288: | Line 235: | ||
* [https://kafka.apache.org/ Apache Kafka] | * [https://kafka.apache.org/ Apache Kafka] | ||
| valign="top" | | | valign="top" | | ||
* [https://www.docker.com/blog/new-docker-desktop-wsl2-backend/ Introducing the Docker Desktop WSL 2 Backend] | * [https://www.docker.com/blog/new-docker-desktop-wsl2-backend/ Introducing the Docker Desktop WSL 2 Backend] | ||
Line 299: | Line 243: | ||
* [https://docs.microsoft.com/en-us/windows/wsl/wsl-config WSL commands and launch config] | * [https://docs.microsoft.com/en-us/windows/wsl/wsl-config WSL commands and launch config] | ||
* [https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0383441 Copy files to/from a container] | * [https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0383441 Copy files to/from a container] | ||
|} | |} |
Revision as of 08:14, 12 June 2021
AMD Ryzen 9 3900x, Ryzen 7 5800H supports virtualization. Almost every processors released since a long time have Virtualization. For Windows it's Vt-x, SVM(in some AMD motherboard vtx is renamed as SVM) or AMD-V.
PowerShell
run as administrator 1. Press ⊞ + R 2. Type in PowerShell 3. Press Ctrl + Shift + Enter 4. Choose Yes and Press Enter
# powershell
net start com.docker.service
net stop com.docker.service
Windows 10 Home
# powershell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
# powershell
docker pull hello-world
docker run -it --rm --name hello hello-world:latest
# gitbash
winpty docker pull hello-world
winpty docker run -it --rm --name hello hello-world:latest
Networking
cat <<EOF > /mnt/c/Users/shahed/.docker/daemon.json
{
"bip": "10.20.13.1/24",
"mtu": 1500,
"dns": [
"10.19.83.100",
"10.19.83.1"
],
"registry-mirrors": [],
"insecure-registries": [],
"debug": true,
"experimental": false,
"features": {
"buildkit": true
},
"builder": {
"gc": {
"enabled": true,
"defaultKeepStorage": "20GB"
}
},
"data-root": "D:\\var\\lib\\docker"
}
EOF
|
cat <<EOF > /mnt/c/Users/shahed/.docker/daemon.json
{
"mtu": 1500,
"debug": true,
"experimental": false,
"default-address-pools": [
{
"base": "10.20.0.0/16",
"size": 24
}
]
}
EOF
|
docker run --rm --detach --publish 1983:80 nginx
docker run --rm --detach --net=host nginx
docker run --rm --detach --publish 1983:80 --net=ckn.b00 --ip 10.20.15.10 nginx
docker run --rm --detach --publish 1983:80 --net=ckn.b01 --ip 10.20.16.10 nginx
Cache or Mirror
mkdir -p /etc/docker/registry
cat <<EOF > /etc/docker/registry/config.yml
proxy:
remoteurl: https://hub.chorke.org
username: academia
password: sadaqah!
EOF
Troubleshoot
docker run --rm --net=host busybox nslookup google.com
docker run --rm --net=host alpine cat /etc/resolv.conf
docker run --rm --net=host alpine nslookup google.com
docker run --rm --net=host alpine ping google.com
docker run --rm --net=host alpine cat /etc/hosts
docker run --rm --net=host alpine ifconfig
docker run --rm --net=host alpine ip addr
docker run --rm --net=host alpine route
|
docker run --rm busybox nslookup google.com
docker run --rm alpine cat /etc/resolv.conf
docker run --rm alpine nslookup google.com
docker run --rm alpine ping google.com
docker run --rm alpine cat /etc/hosts
docker run --rm alpine ifconfig
docker run --rm alpine ip addr
docker run --rm alpine route
|
Images Path
Ubuntu: /var/lib/docker/
Fedora: /var/lib/docker/
Debian: /var/lib/docker/
Windows: C:\ProgramData\DockerDesktop
MacOS: ~/Library/Containers/com.docker.docker/Data/vms/0/
# powershell
wsl -l -v
wsl --shutdown
wsl -d docker-desktop
wsl -d docker-desktop-data
wsl --export docker-desktop docker-desktop.tar
wsl --export docker-desktop-data docker-desktop-data.tar
wsl --unregister docker-desktop
wsl --unregister docker-desktop-data
wsl --import docker-desktop D:\etc\lib\docker\ docker-desktop.tar --version 2
wsl --import docker-desktop-data D:\var\lib\docker\ docker-desktop-data.tar --version 2
Knowledge
docker network ls
docker network prune
docker network rm ckn.b00 ckn.b01
docker inspect nginx|grep "IPAddress"
docker network inspect bridge|grep "Gateway"
docker run --rm -dit --network \
none --name alpine alpine:latest ash;\
docker exec -it alpine ip link show
docker network create --driver bridge \
--opt com.docker.network.bridge.name=ckn.b00 ckn.b00
docker network connect ckn.b00 nginx
docker exec -it nginx cat /etc/hosts
docker inspect nginx|grep "IPAddress"
docker exec -it nginx cat /etc/resolv.conf
docker exec -it nginx ls -lah /sys/class/net/
docker cp ~/.m2/settings.xml alpine:~/.m2/settings.xml
docker cp alpine:~/.m2/settings.xml ~/.m2/settings.xml
docker network disconnect bridge nginx
docker network disconnect ckn.b00 nginx
docker exec -it nginx ls -lah /sys/class/net/
docker run -itd --network=ckn.b00 nginx
docker network disconnect ckn.b00 nginx
docker network connect --alias db --alias mysql ckn.b00 mysql
docker inspect -f '{{.Name}} - {{.NetworkSettings.IPAddress }}' $(docker ps -aq)
docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"
docker ps --filter volume=/data --format "table {{.ID}}\t{{.Mounts}}"
docker ps --format "table {{.ID}}\t{{.Labels}}"
docker ps --format '{{.Names}}\t{{.Image}}'
docker ps --format "{{.ID}}: {{.Command}}"
docker ps --filter publish=80/udp