conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.26k stars 981 forks source link

[bug] conan docker containers fail to install packages #10824

Open gnzlbg opened 2 years ago

gnzlbg commented 2 years ago

To reproduce:

docker run -it -u $(id -u):$(id -g) -v $(pwd):/src -w /src conanio/gcc72:latest bash -c "conan install catch2"

errors with

ERROR: Can't write version file in '/.conan/version.txt': The folder /.conan does not exist and could not be created (Permission denied).

I don't expect this to error.

Most applications have their own docker containers. To use conan, one needs to install and setup conan within those containers.

It would be super helpful to document somewhere how to install conan into an already existing container and how to set it up for development.

gnzlbg commented 2 years ago

In our own containers, I'm seeing errors of the form:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/conans/client/command.py", line 2238, in run
    method(args[0][1:])
  File "/usr/local/lib/python3.8/dist-packages/conans/client/command.py", line 525, in install
    info = self._conan.install(path=args.path_or_reference,
  File "/usr/local/lib/python3.8/dist-packages/conans/client/conan_api.py", line 93, in wrapper
    return f(api, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/conans/client/conan_api.py", line 598, in install
    graph_info = get_graph_info(profile_host, profile_build, cwd, None,
  File "/usr/local/lib/python3.8/dist-packages/conans/client/conan_api.py", line 1571, in get_graph_info
    phost.process_settings(cache)
  File "/usr/local/lib/python3.8/dist-packages/conans/model/profile.py", line 50, in process_settings
    self.processed_settings = cache.settings.copy()
  File "/usr/local/lib/python3.8/dist-packages/conans/client/cache/cache.py", line 227, in settings
    self.initialize_settings()
  File "/usr/local/lib/python3.8/dist-packages/conans/client/cache/cache.py", line 318, in initialize_settings
    save(self.settings_path, normalize(get_default_settings_yml()))
  File "/usr/local/lib/python3.8/dist-packages/conans/util/files.py", line 208, in save
    with open(path, "wb") as handle:
PermissionError: [Errno 13] Permission denied: '/.conan/settings.yml'

ERROR: [Errno 13] Permission denied: '/.conan/settings.yml'
memsharded commented 2 years ago

I think this is not a Conan issue per se, but some docker configuration. What do you think @uilianries?

Maybe move it to conan-docker-tools repo?

uilianries commented 2 years ago

@gnzlbg The image that you mentioned is deprecated and commented here: https://github.com/conan-io/conan-docker-tools#gcc

Please, consider using the images listed on modern directory, also documented here: https://github.com/conan-io/conan-docker-tools/tree/master/modern#gcc

Also, any topic related to Conan Docker images, can discussed on https://github.com/conan-io/conan-docker-tools/issues