Run container in created pod with --share net (default) let application crashs for unknown local hostname
I am using podman-compose and ran into a behaviour, I don't understand yet. Respectively I know how to solve the problem, but I don't get it..I have a compose file, which starts Apache NiFi and some other services like nginx, zookeeper etc. It does not matter if I start all services or only NiFi with podman-compose, all the time I get the same error. And the setting of podman-compose is by default to run all containers in one single pod.
After 10 seconds podman logs this: Received trapped signal, beginning shutdown... for NiFi container. The bootstrap logging of NiFi logs a bit more like this, but enough to understand I think: ERROR [NiFi logging handler] org.apache.nifi.StdErr Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: 4986270786f1: 4986270786f1: Name or service not known podman-compose creates the pod like this: podman pod create --name=<project-name> --share net -p <some-ports> It uses --share net to only share this specific kernel namespace. It can be found at this line. If I create a pod without --share net , podman shares all kernel namespaces (including net) and the problem is solved. It is also solved, if I run --share ipc,pid,uts (cgroups is automatically shared without specifying, I figured out), so without net.
My first question is, why podman-compose has hard coded this parameter?
And my second question is, why a network error is raised if the pod shares only network namespace and does not raise it, when every namespace is shared, as well as every namespace except net is shared? I would expect that it does not raise an error, if only net namespace is shared and raises one if it does not shared..I hope you get it :-)
btw: it runs with docker-compose without any problem..
$ podman version
Version: 1.9.1
RemoteAPI Version: 1
Go Version: go1.11.6
OS/Arch: linux/amd64
$ podman info
host:
arch: amd64
buildahVersion: 1.14.8
cgroupVersion: v1
conmon:
package: 'conmon: /usr/libexec/podman/conmon'
path: /usr/libexec/podman/conmon
version: 'conmon version 2.0.15, commit: '
cpus: 12
distribution:
distribution: debian
version: "10"
eventLogger: file
hostname: <any-hostname>
idMappings:
gidmap:
- container_id: 0
host_id: 2662
size: 1
- container_id: 1
host_id: 951968
size: 65536
uidmap:
- container_id: 0
host_id: 2662
size: 1
- container_id: 1
host_id: 951968
size: 65536
kernel: 4.19.0-8-amd64
memFree: 16260124672
memTotal: 33731375104
ociRuntime:
name: runc
package: 'runc: /usr/sbin/runc'
path: /usr/sbin/runc
version: |-
runc version 1.0.0~rc6+dfsg1
commit: 1.0.0~rc6+dfsg1-3
spec: 1.0.1
os: linux
rootless: true
slirp4netns:
executable: /usr/bin/slirp4netns
package: 'slirp4netns: /usr/bin/slirp4netns'
version: |-
slirp4netns version 1.0.0
commit: unknown
libslirp: 4.2.0
swapFree: 3938185216
swapTotal: 4000313344
uptime: 1106h 57m 27.49s (Approximately 46.08 days)
registries:
search:
- docker.io
- quay.io
store:
configFile: /home/<rootless-user>/.config/containers/storage.conf
containerStore:
number: 7
paused: 0
running: 6
stopped: 1
graphDriverName: overlay
graphOptions:
overlay.mount_program:
Executable: /usr/bin/fuse-overlayfs
Package: 'fuse-overlayfs: /usr/bin/fuse-overlayfs'
Version: |-
fusermount3 version: 3.4.1
fuse-overlayfs: version 0.7.6
FUSE library version 3.4.1
using FUSE kernel interface version 7.27
graphRoot: /home/<rootless-user>/.local/share/containers/storage
graphStatus:
Backing Filesystem: extfs
Native Overlay Diff: "false"
Supports d_type: "true"
Using metacopy: "false"
imageStore:
number: 6
runRoot: /tmp/run-2662/containers
volumePath: /home/<rootless-user>/.local/share/containers/storage/volumes
I installed podman-compose via downloading master-branch and install it with pip3 install podman-compose-master.zip because of this issue https://github.com/containers/podman-compose/issues/54
If you need more information, let me know :-)
Underlying problem is documented in #165.