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

Create a user for the Docker container #10

Open
danielpacak opened this issue Nov 8, 2019 · 2 comments · May be fixed by #29
Open

Create a user for the Docker container #10

danielpacak opened this issue Nov 8, 2019 · 2 comments · May be fixed by #29
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@danielpacak
Copy link
Contributor

There's no reason to run scanner adapter service as root in the Docker container. We should update the Dockerfile respectively.

$ dockle docker.io/goharbor/harbor-scanner-clair:1.0.1-rc1
WARN	- CIS-DI-0001: Create a user for the container
	* Last user should not be root
INFO	- CIS-DI-0005: Enable Content trust for Docker
	* export DOCKER_CONTENT_TRUST=1 before docker pull/build
INFO	- CIS-DI-0006: Add HEALTHCHECK instruction to the container image
	* not found HEALTHCHECK statement
PASS	- CIS-DI-0007: Do not use update instructions alone in the Dockerfile
PASS	- CIS-DI-0008: Confirm safety of setuid/setgid files
PASS	- CIS-DI-0009: Use COPY instead of ADD in Dockerfile
PASS	- CIS-DI-0010: Do not store secrets in ENVIRONMENT variables
PASS	- CIS-DI-0010: Do not store secret files
PASS	- DKL-DI-0001: Avoid sudo command
PASS	- DKL-DI-0002: Avoid sensitive directory mounting
PASS	- DKL-DI-0003: Avoid apt-get/apk/dist-upgrade
PASS	- DKL-DI-0004: Use apk add with --no-cache
PASS	- DKL-DI-0005: Clear apt-get caches
PASS	- DKL-DI-0006: Avoid latest tag
SKIP	- DKL-LI-0001: Avoid empty password
SKIP	- DKL-LI-0002: Be unique UID
SKIP	- DKL-LI-0002: Be unique GROUP
PASS	- DKL-LI-0003: Only put necessary files
@danielpacak danielpacak added enhancement New feature or request good first issue Good for newcomers labels Nov 8, 2019
@mohamedawnallah
Copy link

Hey @danielpacak, I've submitted PR for this issue I would love to receive any feedback! 🙏

@danielpacak
Copy link
Contributor Author

danielpacak commented Jul 9, 2024

Hey @danielpacak, I've submitted PR for this issue I would love to receive any feedback! 🙏

👋 @mohamedawnallah I no longer actively maintain this repository and I'm not sure whether it's actively maintained by the Harbor community either.

Anyway, having look at your changes they makes perfect sense. I was only wondering why you use the USER instruction twice. I suppose that your intention was to created the actual user in the first step, but in order to do that you'd rather use the RUN instruction. This in turn, may require a multistage build as explained at https://medium.com/@lizrice/non-privileged-containers-based-on-the-scratch-image-a80105d6d341. See also https://www.docker.com/blog/understanding-the-docker-user-instruction/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants