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

[docker] Fix running docker container with existing volume #3540

Merged
merged 1 commit into from
Dec 9, 2021

Conversation

csordasmarton
Copy link
Contributor

Closes #3525 and closes #3458

  • Print some useful info message in the entrypoint.sh script file.
  • If the workspace directory already exists when the container started, try
    to run the given command with the owner of the workspace directory, otherwise
    run it with the codechecker user.

@csordasmarton csordasmarton added this to the release 6.18.1 milestone Dec 7, 2021
@whisperity whisperity added the package-Docker 🐳 Issues related to the officially supplied Docker images label Dec 8, 2021
Copy link
Contributor

@whisperity whisperity left a comment

Choose a reason for hiding this comment

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

In general I'm not sure whether we should print these to the standard error, though.

web/docker/entrypoint.sh Outdated Show resolved Hide resolved
web/docker/entrypoint.sh Outdated Show resolved Hide resolved
web/docker/entrypoint.sh Show resolved Hide resolved
web/docker/entrypoint.sh Show resolved Hide resolved
web/docker/entrypoint.sh Outdated Show resolved Hide resolved
- Print some useful info message in the `entrypoint.sh` script file.
- If the `workspace` directory already exists when the container started, try
to run the given command with the owner of the workspace directory, otherwise
run it with the `codechecker` user.
@csordasmarton csordasmarton force-pushed the fix_docker_entry_point branch from 9ff8234 to 202f72d Compare December 8, 2021 11:27
Comment on lines +16 to +17
echo "Executing script with workspace directory owner (UID): '${workspace_dir_owner}'..."
exec gosu $workspace_dir_owner "$0" "$@"
Copy link
Contributor

@whisperity whisperity Dec 8, 2021

Choose a reason for hiding this comment

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

Thanks, can confirm this works!

$ docker run -v $(readlink -f workspace):/workspace codechecker-web:csordasmarton/fix_docker_entry_point
Container started with 'root' user.
Workspace directory '/workspace' already exists.
Executing script with workspace directory owner (UID): '1000'...
Executing command: 'CodeChecker server --workspace /workspace --not-host-only'.
[INFO 2021-12-08 11:25] - Checking configuration database ...
$ pwd; ls -alh
/home/whisperity/CodeChecker/web/docker/workspace
Permissions Size User       Date Modified Name
.rw-r--r--   57k whisperity  8 Dec 12:25  config.sqlite
.rw-r--r--  209k whisperity  8 Dec 12:25  Default.sqlite
.r--------    71 whisperity  8 Dec 12:25  root.user
.rw-r--r--  1,6k whisperity  8 Dec 12:25  server_config.json

@bruntib bruntib merged commit bd79e0b into Ericsson:master Dec 9, 2021
@csordasmarton csordasmarton deleted the fix_docker_entry_point branch January 28, 2022 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix 🔨 package-Docker 🐳 Issues related to the officially supplied Docker images
Projects
None yet
3 participants