0

I'm trying to install brew in my container but it's impossible.

Docker-compose.yml:

version: '3.9'

services:

# Application service
      hermes:
              depends_on:
                      - db
                      - adminer
              build:
                      context: ./hermes-app/
              container_name: hermes
              ports:
                      - "5000:5000"
              tty: true
      db:
              image: postgres
              restart: always
              container_name: postgres
              volumes:
                      - ./hermes-app/db:/var/lib/postgresql/data
      adminer:
              image: adminer
              restart: always
              ports:
                - 8080:8080

Dockerfile:

FROM ruby:3.1.1

# Install dependencies
RUN apt-get update && apt-get install -y \
    sudo \
    vim \
    build-essential \
    curl \
    git \
    libcurl4-openssl-dev \
    libffi-dev \
    libreadline-dev \
    libssl-dev \
    libxml2-dev \
    libxslt1-dev \
    libyaml-dev \
    zlib1g-dev \
    postgresql \
    ruby-build

# Create workspace
RUN mkdir -p /hermes-app
WORKDIR /hermes-app
COPY srcs/ .

# Install ruby dependencies
RUN gem install bundler
RUN bundle install

EXPOSE 5000

I already tried with different ways but i can't do it.

If i use the command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

The output is:

==> Checking for `sudo` access (which may request your password)...
Don't run this as root!

And if i changed the user to non-root user the output is:

==> Checking for `sudo` access (which may request your password)...
==> Select a Homebrew installation directory:
- Enter your password to install to /home/linuxbrew/.linuxbrew (recommended)
- Press Control-D to install to /home/moderator/.linuxbrew
- Press Control-C to cancel installation
Homebrew on Linux is not supported on ARM processors.
You can try an alternate installation method instead:
  https://docs.brew.sh/Homebrew-on-Linux#arm

Anyone can help me?, thanks in advance...

  • What do you actually need it for? The [Debian package archive](https://packages.debian.org) is pretty extensive and you should be able to add most things you need to your existing `apt-get install` command. (The last error message suggests Homebrew on ARM Linux isn't an option at all.) – David Maze Aug 02 '22 at 11:19
  • @DavidMaze Because i already have some problems trying to setup the environment for Ruby, so, it's better use the ruby pkg but now i have problems with Brew. –  Aug 02 '22 at 11:34
  • The `ruby` base image should have the interpreter already installed (you do not need `ruby-build` here for example). Consider asking a new question more specifically about the Ruby setup issue. – David Maze Aug 02 '22 at 11:38
  • i need install ruby-build for enable the "rbenv" command, you know why i can not install Brew in the container?, i think it's a simple question –  Aug 02 '22 at 11:43
  • You don't need `rbenv` either: the `ruby:3.1.1` base image already has MRI 3.1.1 installed in it. (More generally, version managers like `rbenv` are tricky to set up in Docker and usually aren't necessary, since a Docker image contains only a single application and the single language runtime needed for it.) As the final error message says, Homebrew doesn't work on Linux on ARM systems like M1 Macs and I don't think you can use it at all here. – David Maze Aug 02 '22 at 12:05
  • 1
    (I feel like there is some underlying Ruby-related issue you're trying to solve, and more directly addressing that problem would be more helpful than focusing on installing an alternative package manager. See the [What is the XY problem?](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) FAQ as well.) – David Maze Aug 02 '22 at 12:14
  • Okay, I'm trying now with image from debian:buster but i have error while install rvm root@cb6515209ba0:/# gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB gpg: keyserver receive failed: Server indicated a failure –  Aug 02 '22 at 12:27
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/246967/discussion-between-bart-and-david-maze). –  Aug 02 '22 at 12:29
  • @DavidMaze I think is more complicated try to make a setup for Ruby from debian than install other pkg manager, but well, i will try –  Aug 02 '22 at 12:30
  • @DavidMaze https://stackoverflow.com/questions/73207888/how-to-change-the-ruby-version-into-container-docker –  Aug 02 '22 at 12:53

0 Answers0