Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a numeric USER instruction in Dockerfiles #1082

Merged
merged 1 commit into from
Jul 14, 2020
Merged

Use a numeric USER instruction in Dockerfiles #1082

merged 1 commit into from
Jul 14, 2020

Conversation

srguglielmo
Copy link
Contributor

NOTE: This is a replacement for PR #1073 on master. As requested, only Dockerfile.txt is changed (not Dockerfile). Original PR text folllows:

Description

By using a numeric USER instruction in Dockerfiles, the images are now able to pass a strict Kubernetes securityContext configuration. Specifically, runAsNonRoot, which requires a numeric user/group ID. It is also a Docker best practice. The values of 1200 and 1201 are arbitrary.

Motivation and Context

While running a Selenium grid cluster in Kubernetes, I noticed I was unable to run the images with runAsNonRoot: true due to the following error:

CreateContainerConfigError: container has runAsNonRoot and image has non-numeric user (seluser), cannot verify user is non-root

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Here's an example of the k8s config that runs successfully after this patch:

apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
      - name: hub
        image: selenium/hub:local
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - ALL
          privileged: false
          readOnlyRootFilesystem: false
          runAsNonRoot: true

I can run VERSION=local make build locally successfully. Let me know if there's anything I can change or if this can be tested somehow.

Thanks,
Steve

Copy link
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @srguglielmo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants