M
M
Maximilian Timofeev2015-05-10 11:48:54
ubuntu
Maximilian Timofeev, 2015-05-10 11:48:54

How to close access to Docker using UFW?

There is a server on which docker is running, listening on port 4321. There is a goal: to prohibit access to docker from outside.
For this I use UFW.
Settings result:
$ ufw status verbose

Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), allow (routed)
New profiles: skip
To Action From
-- ------ ----
80 ALLOW IN Anywhere
22 ALLOW IN Anywhere
4321 DENY IN Anywhere
80 (v6) ALLOW IN Anywhere (v6)
22 (v6) ALLOW IN Anywhere (v6)
4321 (v6) DENY IN Anywhere (v6)

But docker can still be reached from the outside through port 4321.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Rogozhkin, 2017-03-11
@thecoder

No, not even through iptables. Docker can only restrict access by itself. Use the --network=host directive when starting the container so that it forwards ports not to the default bridge network, but only to a host that is not accessible from the outside.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question