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

Add support for containers with no entrypoint/cmd #2173

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

mbrancato
Copy link
Contributor

@mbrancato mbrancato commented Nov 3, 2024

The API call to create a docker image (e.g. the docker command docker create) does not support creating a non-running container with no entrypoint or command specified. This will cause oscap-docker to fail with the HTTP 400 error from the Docker service:

docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.45/containers/create: Bad Request 
("no command specified")

To solve this, for scanning purposes only, pass a null character as the explicit command for all containers.

An example Dockerfile for a container with no command is below. It is more common for container images designed to be used as a base container to have no command as they are not intended to be run directly.

FROM scratch
COPY . /

@jan-cerny jan-cerny self-assigned this Nov 12, 2024
@jan-cerny jan-cerny merged commit e0e1789 into OpenSCAP:main Nov 12, 2024
19 checks passed
@jan-cerny jan-cerny added this to the 1.3.11 milestone Nov 12, 2024
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