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

Build errors with docker-compose. #977

Open
therealmaxmoon opened this issue Aug 22, 2023 · 2 comments
Open

Build errors with docker-compose. #977

therealmaxmoon opened this issue Aug 22, 2023 · 2 comments

Comments

@therealmaxmoon
Copy link

therealmaxmoon commented Aug 22, 2023

I am trying to install a local version of thredded to just test it, but I had no luck the last hours. Does someone have this forum software running so I could test it and just take a look, because installing it by myself looks like it costs a lot more time and energy.

I used the following command in the root directory of the repository:

docker-compose build

Used versions:

Docker version 20.10.5+dfsg1, build 55c4c88

docker-compose version 1.27.4, build unknown

The Errors:

Traceback (most recent call last):
  File "/home/maxmoon/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/home/maxmoon/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.9/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1010, in _send_output
    self.send(msg)
  File "/usr/lib/python3.9/http/client.py", line 950, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/docker/transport/unixconn.py", line 30, in connect
    sock.connect(self.unix_socket)
PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/maxmoon/.local/lib/python3.9/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/home/maxmoon/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "/home/maxmoon/.local/lib/python3.9/site-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/maxmoon/.local/lib/python3.9/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/home/maxmoon/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/home/maxmoon/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.9/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1010, in _send_output
    self.send(msg)
  File "/usr/lib/python3.9/http/client.py", line 950, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/docker/transport/unixconn.py", line 30, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/docker/api/client.py", line 214, in _retrieve_server_version
    return self.version(api_version=False)["ApiVersion"]
  File "/usr/lib/python3/dist-packages/docker/api/daemon.py", line 181, in version
    return self._result(self._get(url), json=True)
  File "/usr/lib/python3/dist-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/docker/api/client.py", line 237, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/home/maxmoon/.local/lib/python3.9/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
  File "/home/maxmoon/.local/lib/python3.9/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/maxmoon/.local/lib/python3.9/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/home/maxmoon/.local/lib/python3.9/site-packages/requests/adapters.py", line 547, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.27.4', 'console_scripts', 'docker-compose')())
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 67, in main
    command()
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 123, in perform_command
    project = project_from_options('.', options)
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 60, in project_from_options
    return get_project(
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 131, in get_project
    client = get_client(
  File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 41, in get_client
    client = docker_client(
  File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 170, in docker_client
    client = APIClient(**kwargs)
  File "/usr/lib/python3/dist-packages/docker/api/client.py", line 197, in __init__
    self._version = self._retrieve_server_version()
  File "/usr/lib/python3/dist-packages/docker/api/client.py", line 221, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', PermissionError(13, 'Permission denied'))

@therealmaxmoon
Copy link
Author

I figured out that it must be executed as root and I didn't think about this, because in general I log in as root on my server to execute docker stuff.

So, if you're on a local machine and logged in as an unprivileged user, execute it as root:

sudo docker-compose build

But I ran into other errors:


db uses an image, skipping
Building web
Step 1/14 : FROM alpine:3.11
 ---> a787cb986503
Step 2/14 : RUN apk add --no-cache     ruby ruby-bundler ruby-bigdecimal ruby-io-console ruby-json ruby-webrick tzdata nodejs yarn bash     build-base ruby-dev libc-dev libffi-dev linux-headers gmp-dev libressl-dev libxml2-dev libxslt-dev     mariadb-connector-c-dev postgresql-dev sqlite-dev git     chromium
 ---> Using cache
 ---> ea6943d1dcb6
Step 3/14 : RUN gem install foreman
 ---> Using cache
 ---> 391bbd80c885
Step 4/14 : ENV BUNDLE_SILENCE_ROOT_WARNING=1
 ---> Using cache
 ---> 00c001e83f0b
Step 5/14 : ENV BUNDLE_PATH=/bundle
 ---> Using cache
 ---> 141968bc27e1
Step 6/14 : ENV DOCKER=1
 ---> Using cache
 ---> f4cb92c6d882
Step 7/14 : ENV APP_HOME /thredded
 ---> Using cache
 ---> 0a04d86986f1
Step 8/14 : WORKDIR $APP_HOME
 ---> Using cache
 ---> 168a911e1b80
Step 9/14 : RUN mkdir -p $APP_HOME/tmp/pids
 ---> Using cache
 ---> 1e28d9abc41b
Step 10/14 : COPY ./lib/thredded/version.rb $APP_HOME/lib/thredded/
 ---> Using cache
 ---> 5a4de5558632
Step 11/14 : COPY thredded.gemspec shared.gemfile i18n-tasks.gemfile rubocop.gemfile Gemfile $APP_HOME/
 ---> Using cache
 ---> d288f4c9b81c
Step 12/14 : RUN bundle --path=$BUNDLE_PATH -j $(nproc)
 ---> Running in 90d9c92a1ad9
Your Gemfile lists the gem capybara-screenshot (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once (per group).
While it's not a problem now, it could cause errors if you change the version of one of them later.
Your Gemfile lists the gem rails-controller-testing (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once (per group).
While it's not a problem now, it could cause errors if you change the version of one of them later.
Your Gemfile lists the gem thredded-markdown_coderay (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once (per group).
While it's not a problem now, it could cause errors if you change the version of one of them later.
Your Gemfile lists the gem thredded-markdown_katex (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once (per group).
While it's not a problem now, it could cause errors if you change the version of one of them later.
Fetching https://github.com/thredded/db_text_search.git
Fetching https://github.com/thredded/thredded-markdown_coderay
Fetching https://github.com/thredded/thredded-markdown_katex
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "ruby":
  In Gemfile:
    ruby

    rails (~> 7.0.0) was resolved to 7.0.7.2, which depends on
      ruby (>= 2.7.0)

    thredded was resolved to 1.1.0, which depends on
      ruby (>= 2.1, < 4.0)
ERROR: Service 'web' failed to build : The command '/bin/sh -c bundle --path=$BUNDLE_PATH -j $(nproc)' returned a non-zero code: 6

How can this be solved?

Thank you for your help :)

@timdiggins
Copy link
Collaborator

Hi @therealmaxmoon

I've never used the Dockerfile in this repo, and it's quite old (hasn't been updated in the repo) and maybe the version of alpine is a bit old or there are other issues with the OOB ruby install (maybe bundler or rubygems needs updating or installing)? (I don't normally use alpine, so I'm a bit lost here) -- our CI doesn't use docker and I don't locally for testing either.

In terms of the sudo vs not sudo, i think that will depend on how you've installed docker and local issues (ie. it will vary from user to user)

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

No branches or pull requests

2 participants