Comments (7)
Any just FWIW, simply doing yum install upstart as part of our Dockerfile doesn't seem to resolve things, since there appears to be an issue with doing docker run -d --privileged=true -h HOSTNAME on the resultant image (the hostname doesn't actually get set). This wasn't the case (and continues to not be the case) for the centos6.6 tag.
from sig-cloud-instance-images.
That part is very interesting, because beyond the missing upstart package the only thing I've done different was to use anaconda itself to create the tarball vs ami_creator. They should be doing the same things, but one is a part of the distro and the other is an obsolete tool that's not maintained.
from sig-cloud-instance-images.
So just as an update, this issue still occurs and can be reproduced as follows:
- Create a Dockerfile that installs upstart, openssh-server, and passwd (for setting the root password)
FROM centos:6.7
RUN yum update -y && yum install -y upstart openssh-server passwd
RUN echo "password" | passwd root --stdin
- Build image:
docker build -t testbrokenhostname .
- Start a container from the image in daemon mode with command
/sbin/init
and specifying a hostname offirst
on the command line, saving the IP address into a variable:
THE_FIRST_IP_ADDRESS=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(docker run -d --hostname=first testbrokenhostname /sbin/init))
ssh "${THE_IP_ADDRESS}"
- Run
hostname
and note that you seefirst
- Exit out (^D) and start up a second container, this time in privileged mode:
THE_SECOND_IP_ADDRESS=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(docker run -d --privileged --hostname=second testbrokenhostname /sbin/init))
ssh "${THE_SECOND_IP_ADDRESS}"
- Note that running
hostname
returns something likelocalhost.localdomain
instead ofsecond
, which was specified.
As noted previously, in centos:6.6, which includes upstart, this isn't an issue. Perhaps there's something else missing from this image?
from sig-cloud-instance-images.
Some investigating and I've found some workarounds (and think I understand where the problem is coming in). Basically, the centos6.6 and centos6.7 tarballs are very different insofar as their /etc/sysconfig/network-scripts/ifcfg-eth0 files. In particular, the centos6.7 one has the following:
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="52:54:00:49:CA:52"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
MTU="1500"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="5b9d5724-dc26-45c6-bca5-916bbc484794"
while centos6.6 is much simpler:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=on
As it turns out, overwriting the file from centos6.7 with this simpler version fixes things for me. Perhaps the kickstart scripts' updated network arguments (--activate --onboot=on
was added between centos-6.6.ks and centos-6.ks) could be the culprit?
from sig-cloud-instance-images.
This is something I'll look into fixing in the next build of the '6' container. the minor point containers (6.6, 6.7 etc) don't get updates by design. If/when 6.8 comes around, it should be resolved there as well.
from sig-cloud-instance-images.
Thanks, Jim. I think I understand now that this shows up because, in privileged mode (or with CAP_SYS_ADMIN
as an allowed capability), the container is able to run the /etc/rc.d/rc.sysinit
script, which, in part, sources /etc/sysconfig/network
(which contains a HOSTNAME=localhost.localdomain
line). Where /etc/sysconfig/network-script/ifcfg-eth0
comes into play here is unclear to me, though, so if you ever do figure out this part of the puzzle, I'd love to hear it.
from sig-cloud-instance-images.
@jperrin I'm currently using centos:6 in my kitchen-dokken work on chef-compliance, and I can verify with you that in privileged mode (needed because of sysctl settings) the hostname is still not set; however in centos:7 this does work.
from sig-cloud-instance-images.
Related Issues (20)
- download linux centos
- Centos:7 image contains old kernel with security vulnerabilities HOT 2
- Linux Permission Issue
- CentOS-8-Stream docker file needs update
- centos7.8.2003 arm64 build
- When will CentOS 8.4.2105 be available on dockerhub? HOT 2
- will there a new centos 7 image with the security issues fixed? HOT 1
- remove ethtool
- When will CentOS 8.5.2111 be available on quay.io? HOT 4
- all cmake make
- centos 8 repo mirrorlists are deprecated HOT 12
- CentOS 7: vault.centos.org now has HSTS enabled, but default repo config uses `http` HOT 1
- Suggestion: Update the CentOS source IP address to the latest version
- centos 7 image vulnerabilities
- Build CentOS image with ssh enabled. FAILED! HOT 1
- How to upgrade the kernel of centos7 in a container
- `GLIBC_2.29` not found
- [Feature Request] yum install OpenSSL3 HOT 1
- Support for CentOS 9 docker image HOT 1
- I can't update the Centos7 image
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sig-cloud-instance-images.