Diferencia entre revisiones de «Docker Engine»
Sin resumen de edición |
Sin resumen de edición |
||
| Línea 15: | Línea 15: | ||
<syntaxhighlight lang="Bash">ufw disable</syntaxhighlight> | <syntaxhighlight lang="Bash">ufw disable</syntaxhighlight> | ||
<syntaxhighlight lang="Bash">systemctl disable ufw</syntaxhighlight> | <syntaxhighlight lang="Bash">systemctl disable ufw</syntaxhighlight> | ||
<syntaxhighlight lang="Bash">systemctl stop ufw</syntaxhighlight> | |||
<syntaxhighlight lang="Bash">apt remove --purge ufw</syntaxhighlight> | <syntaxhighlight lang="Bash">apt remove --purge ufw</syntaxhighlight> | ||
| Línea 20: | Línea 21: | ||
<syntaxhighlight lang="Bash">apt update</syntaxhighlight> | <syntaxhighlight lang="Bash">apt update</syntaxhighlight> | ||
<syntaxhighlight lang="Bash">apt install firewalld</syntaxhighlight> | <syntaxhighlight lang="Bash">apt install firewalld</syntaxhighlight> | ||
<syntaxhighlight lang="Bash">systemctl enable | <syntaxhighlight lang="Bash">systemctl enable firewalld</syntaxhighlight> | ||
<syntaxhighlight lang="Bash">systemctl start firewalld</syntaxhighlight> | <syntaxhighlight lang="Bash">systemctl start firewalld</syntaxhighlight> | ||
=== Habilitar modo | === Habilitar modo IPTables a FirewallD (opcional) === | ||
Hay problemas reportados de conexión entre contenedores de Docker cuando FirewallD está en modo nftables, se resuelven cambiando a modo IPTables. | |||
<syntaxhighlight lang="Bash">vi /etc/firewalld/firewalld.conf</syntaxhighlight> | |||
<syntaxhighlight lang="text"> | |||
[...] | |||
# FirewallBackend | |||
# Selects the firewall backend implementation. | |||
# Choices are: | |||
# - nftables (default) | |||
# - iptables (iptables, ip6tables, ebtables and ipset) | |||
# Note: The iptables backend is deprecated. It will be removed in a future | |||
# release. | |||
#FirewallBackend=nftables | |||
FirewallBackend=iptables | |||
[...] | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="Bash">systemctl restart firewalld</syntaxhighlight> | |||
=== Habilitar reglas anteriores === | |||
En mi paso prefiero habilitar puertos TCP en vez de servicios (aunque también es posible). | |||
<syntaxhighlight lang="Bash">firewall-cmd --add-port=80/tcp</syntaxhighlight> | |||
<syntaxhighlight lang="Bash">firewall-cmd --add-port=443/tcp</syntaxhighlight> | |||
<syntaxhighlight lang="Bash">firewall-cmd --runtime-to-permanent</syntaxhighlight> | |||
== Referencias == | == Referencias == | ||
* [https://docs.docker.com/engine/install/ubuntu/ https://docs.docker.com/engine/install/ubuntu/] | * [https://docs.docker.com/engine/install/ubuntu/ https://docs.docker.com/engine/install/ubuntu/] | ||
* [https://docs.docker.com/engine/network/packet-filtering-firewalls/#docker-and-ufw https://docs.docker.com/engine/network/packet-filtering-firewalls/#docker-and-ufw] | * [https://docs.docker.com/engine/network/packet-filtering-firewalls/#docker-and-ufw https://docs.docker.com/engine/network/packet-filtering-firewalls/#docker-and-ufw] | ||
* [https://github.com/nextcloud/all-in-one?tab=readme-ov-file#how-to-resolve-firewall-problems-with-fedora-linux-rhel-os-centos-suse-linux-and-others https://github.com/nextcloud/all-in-one?tab=readme-ov-file#how-to-resolve-firewall-problems-with-fedora-linux-rhel-os-centos-suse-linux-and-others] | |||
[[Categoría:Notas]] | [[Categoría:Notas]] | ||
Revisión del 22:28 26 feb 2026
Instalación de Docker Engine en Ubuntu Server
El objetivo de este documento es instalar Docker Engine en Ubuntu Server 24.04.
Requisitos
Antes de instalar Docker hay que tener en cuenta una serie de consideraciones.
Usuario root
Todos los comandos que aquí se ponen, han de ejecutarse como root.
sudo -i
Desinstalar UFW
El firewall que viene por defecto en entornos tipo Debian (como Ubuntu) tiene problemas de compatibilidad con Docker Engine. Debido a que Docker crea reglas directamente con IPTables, se ocasiona que Docker cree reglas que se salten las reglas existentes. Para evitar que esto pase vamos a sustituir UFW por FirewallD (en modo IPTables), que evita este tipo de problemas.
ufw disable
systemctl disable ufw
systemctl stop ufw
apt remove --purge ufw
Instalar FirewallD
apt update
apt install firewalld
systemctl enable firewalld
systemctl start firewalld
Habilitar modo IPTables a FirewallD (opcional)
Hay problemas reportados de conexión entre contenedores de Docker cuando FirewallD está en modo nftables, se resuelven cambiando a modo IPTables.
vi /etc/firewalld/firewalld.conf
[...]
# FirewallBackend
# Selects the firewall backend implementation.
# Choices are:
# - nftables (default)
# - iptables (iptables, ip6tables, ebtables and ipset)
# Note: The iptables backend is deprecated. It will be removed in a future
# release.
#FirewallBackend=nftables
FirewallBackend=iptables
[...]
systemctl restart firewalld
Habilitar reglas anteriores
En mi paso prefiero habilitar puertos TCP en vez de servicios (aunque también es posible).
firewall-cmd --add-port=80/tcp
firewall-cmd --add-port=443/tcp
firewall-cmd --runtime-to-permanent