3

Give the example here which has an attempt at setting the hostname to foo.bar.baz for the duration of the build,

#!/bin/bash
ctr=$(buildah from alpine:3)
buildah run --hostname 'foo.bar.baz' $ctr /bin/sh <<-'EOF'
  echo "/usr/bin/hostname returns [$(hostname)]";
EOF

I get the following output,

/usr/bin/hostname returns [myHostname]

I was expecting hostname to return foo.bar.baz.

I'm using Debian Testing's buildah package 1.15.2-1.

❯ buildah version
Version:         1.15.2
Go Version:      go1.14.7
Image Spec:      1.0.1
Runtime Spec:    1.0.2-dev
CNI Spec:        0.4.0
libcni Version:  
image Version:   5.5.2
Git Commit:      
Built:           Wed Dec 31 18:00:00 1969
OS/Arch:         linux/amd64

But I've also tested it on 1.17,

❯ buildah version
Version:         1.17.0
Go Version:      go1.15.2
Image Spec:      1.0.1-dev
Runtime Spec:    1.0.2-dev
CNI Spec:        0.4.0
libcni Version:  
image Version:   5.7.0
Git Commit:      
Built:           Wed Dec 31 18:00:00 1969
OS/Arch:         linux/amd64
Evan Carroll
  • 28,578
  • 45
  • 164
  • 290

1 Answers1

2

I filed this as a bug on GitHub (#2775).

It seems it's hardwired but not documented, from irc.freenode.net/#podman

nalind> buildah run is hardwired to disable UTS namespace in rootless mode, don't remember why

...

nalind> EvanCarroll: unless it's a limitation we put in place for the sake of runc or crun, not being able to use a private UTS namespace in buildah run a fixable bug

Evan Carroll
  • 28,578
  • 45
  • 164
  • 290