RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1546870 - dockerd man page: --userns-remap=default does NOT create user namespace map
Summary: dockerd man page: --userns-remap=default does NOT create user namespace map
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker
Version: 7.5
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Tom Sweeney
QA Contact: atomic-bugs@redhat.com
Depends On:
TreeView+ depends on / blocked
Reported: 2018-02-19 20:49 UTC by Chris Evich
Modified: 2019-03-06 01:05 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Man page for usernamespace was lacking in details on subgid and subuid support on RHEL. This has been clarified.
Clone Of:
Last Closed: 2018-11-19 19:18:08 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Chris Evich 2018-02-19 20:49:46 UTC
Description of problem:
This may be correct for upstream, but it doesn't seem to work on RHEL 7.5.

  Enable user namespaces for containers on the daemon. Specifying "default"
  will cause a new user and group to be created to handle UID and GID range
  remapping for the user namespace mappings used for contained processes.
  Specifying a user (or uid) and optionally a group (or gid) will cause the
  daemon to lookup the user and group's subordinate ID ranges for use as the
  user namespace mappings for contained processes.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Add --userns-remap=default to OPTIONS in /etc/sysconfig/docker
2. restart docker service

Actual results:

dockerd-current[*]: Can't create ID mappings: No subuid ranges found for user "dockremap"

Expected results:

New maps would be added to /etc/sub{uid,gid}

Additional info:

Wrong documentation is worse than no documentation.  
Suggest getting rid of that section or correcting it for RHEL.  e.g. 

  Enable user namespaces for containers on the daemon. Specifying "default"
  expects a UID and GID range map for the 'dockremap' to already be defined.
  Specifying a user (or uid) and optionally a group (or gid) will cause the
  daemon to lookup the user and group's subordinate ID ranges for use as the
  user namespace mappings for contained processes.

Comment 2 Daniel Walsh 2018-02-21 21:52:16 UTC
I think you have to add the range you want to use into  /etc/sub{uid,gid}

Do you think we should do this in the spec file?

Comment 3 Ed Santiago 2018-02-22 14:28:20 UTC
The actual root cause is:

    Error during "dockremap" user creation: Couldn't create subordinate ID ranges: Unable to add subuid range to user: "dockremap"; output: usermod: invalid option -- 'v'

The problem is in pkg/idtools/usergroupadd_linux.go , which runs 'usermod -v <N> <N+range> dockremap'. Fedora usermod includes -v/-w options for updating /etc/subuid & subgid respectively; RHEL does not. I do not see an equivalent mechanism in RHEL for updating those files.

All the RHEL documentation I've ever seen for docker + user namespaces clearly indicate that a human must add 'dockremap' lines into /etc/sub[ug]id. I believe the best solution for RHEL is to update the man page accordingly, and (bonus points) update usergroupadd_linux.go to include a more helpful error message such as "sorry, RHEL does not support dynamic creation of subid ranges, please see dockerd(1) and edit /etc/sub[ug]id manually"

Comment 4 Chris Evich 2018-02-28 17:19:20 UTC
Ahh, thanks for the extra details Ed.  Yes, that's my understanding as well (must manually add).  Good idea about patching the error message in addition to man page, ya that would be nice.

In case the burden of carrying another patch for the binary is a PITA, I think we could live with just the man page at a minimum.  Since this is a non-default option, it's a safe bet a user will encounter either the (corrected) man page or the docs, before or after breaking it, so that should be good'nuff IMHO.

Comment 5 Tom Sweeney 2018-03-02 01:59:18 UTC
It looks like pkg/idtools/usergroupadd_linux.go is only gotten into if you specify the uid/gid in the userns-remap argument and they don't already exist in the files.  The error that Chris ran into is the route you get if you specify default.  In that instance it's not going to try to create the entries, it just throws an error if they're not found.  pkg/idtools/idtools.go:CreateIDMappings.  I've adjusted the man page in my sandbox, will ponder better error messaging in the morn.

Comment 6 Tom Sweeney 2018-03-02 19:53:29 UTC
I've created: 


for Docker 13.1.  Once this gets blessed, I'll create a PR for 13.1-RHEL too.

I decided to not change the messaging in pkg/idtools/usergroupadd_linux.go when usermod fails.  I was concerned that if the usermod functionality is ever added to RHEL to update subuid/subgid, then the messaging would be off if the error wasn't related.

I did update the error that Chris ran into appending "in /etc/subuid" or "in /etc/subgid" as appropriate.  I also updated the manpage.

Comment 7 Tom Sweeney 2018-03-16 20:50:13 UTC
For Docker 1.13.1-RHEL, I created this PR:  https://github.com/projectatomic/docker/pull/303.

Once merged, I'll close out this BZ.

Comment 8 Tom Sweeney 2018-03-26 18:46:40 UTC
https://github.com/projectatomic/docker/pull/303 has been merged, I'm setting this BZ to On_QA.

Comment 13 Chris Evich 2018-11-19 19:18:08 UTC
Inspected man page for docker daemon.  It was updated to clarify manual editing is required.

Note You need to log in before you can comment on or make changes to this bug.