Install Docker in Raspberry Pi 4: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 34: | Line 34: | ||
"mtu" : 1500, | "mtu" : 1500, | ||
"dns" : [ | "dns" : [ | ||
"10.19.83. | "10.19.83.100", | ||
"10.19.83.1" | "10.19.83.1" | ||
], | ], | ||
Line 57: | Line 57: | ||
</source> | </source> | ||
|} | |} | ||
<source lang="bash"> | |||
apt install -y iputils | |||
iptables -t nat -S | |||
service docker stop | |||
service docker start | |||
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 | |||
</source> | |||
===Bridge=== | |||
<source lang="bash"> | |||
docker network create \ | |||
--driver bridge \ | |||
--gateway 10.20.15.1 \ | |||
--subnet 10.20.15.0/24 \ | |||
--opt com.docker.network.driver.mtu=1500 \ | |||
--opt com.docker.network.bridge.enable_icc=true \ | |||
--opt com.docker.network.bridge.enable_ip_masquerade=true \ | |||
--opt com.docker.network.bridge.host_binding_ipv4=0.0.0.0 \ | |||
--opt com.docker.network.bridge.name=ckn.b00 ckn.b00 | |||
</source> | |||
== References == | == References == | ||
* [https://medium.com/@sipkeschoorstra/installing-docker-on-raspberry-pi-4-b010d3792b2d Installing Docker on Raspberry Pi 4] | * [https://medium.com/@sipkeschoorstra/installing-docker-on-raspberry-pi-4-b010d3792b2d Installing Docker on Raspberry Pi 4] | ||
* [https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl Installing Docker Compose on Raspberry Pi 4] | * [https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl Installing Docker Compose on Raspberry Pi 4] |
Revision as of 02:25, 3 January 2021
df -h
vcgencmd measure_temp
apt list --upgradable
apt upgrade
apt install openjdk-8-jdk/stable
apt install openjdk-11-jdk/stable
df -h
curl -sSL https://get.docker.com | sh
usermod -aG docker pi
docker --version
df -h
docker run hello-world
docker ps -a
docker images
apt install libffi-dev libssl-dev
apt install python3 python3-pip
apt remove python-configparser
pip3 install docker-compose
df -h
Networking
cat <<EOF > /etc/docker/daemon.json
{
"bip" : "10.20.13.1/24",
"mtu" : 1500,
"dns" : [
"10.19.83.100",
"10.19.83.1"
],
"debug": true
}
EOF
|
cat <<EOF > /etc/docker/daemon.json
{
"mtu" : 1500,
"debug" : true,
"experimental": false,
"default-address-pools" :[{
"base" : "10.20.0.0/16",
"size" : 24
}]
}
EOF
|
apt install -y iputils
iptables -t nat -S
service docker stop
service docker start
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
Bridge
docker network create \
--driver bridge \
--gateway 10.20.15.1 \
--subnet 10.20.15.0/24 \
--opt com.docker.network.driver.mtu=1500 \
--opt com.docker.network.bridge.enable_icc=true \
--opt com.docker.network.bridge.enable_ip_masquerade=true \
--opt com.docker.network.bridge.host_binding_ipv4=0.0.0.0 \
--opt com.docker.network.bridge.name=ckn.b00 ckn.b00