mirror of
https://github.com/chaifeng/ufw-docker.git
synced 2025-07-04 01:26:14 +02:00
Update Dockerfile, add support for iptables legacy mode via a build arg
This commit is contained in:
parent
1a51b59cf8
commit
276324acf0
2 changed files with 17 additions and 6 deletions
10
Dockerfile
10
Dockerfile
|
@ -1,6 +1,7 @@
|
|||
FROM ubuntu:24.04
|
||||
|
||||
ARG docker_version="27.3.1"
|
||||
ARG use_iptables_legacy=false
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update \
|
||||
|
@ -14,6 +15,15 @@ RUN apt-get update \
|
|||
&& apt-get install -y --no-install-recommends locales ufw \
|
||||
&& apt-get install -y --no-install-recommends "docker-ce=$(apt-cache madison docker-ce | grep -m1 -F "${docker_version}" | cut -d'|' -f2 | tr -d '[[:blank:]]')" \
|
||||
&& locale-gen en_US.UTF-8 \
|
||||
&& if "$use_iptables_legacy"; then \
|
||||
apt-get -y install arptables ebtables \
|
||||
&& update-alternatives --install /usr/sbin/arptables arptables /usr/sbin/arptables-legacy 100 \
|
||||
&& update-alternatives --install /usr/sbin/ebtables ebtables /usr/sbin/ebtables-legacy 100 \
|
||||
&& update-alternatives --set iptables /usr/sbin/iptables-legacy \
|
||||
&& update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy \
|
||||
&& update-alternatives --set arptables /usr/sbin/arptables-legacy \
|
||||
&& update-alternatives --set ebtables /usr/sbin/ebtables-legacy; \
|
||||
fi \
|
||||
&& apt-get clean autoclean \
|
||||
&& apt-get autoremove --yes \
|
||||
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue