openSUSE / open-build-service

Build and distribute Linux packages from sources in an automatic, consistent and reproducible way #obs
https://openbuildservice.org
GNU General Public License v2.0
936 stars 440 forks source link

docker build not work please solve #12762

Closed amidevous closed 2 years ago

amidevous commented 2 years ago
rake docker:build
git config commit.template .gitmessage
touch docker-files/home/.bash_history docker-files/home/.irb_history docker-files/home/.pry_history
cat << EOF > docker-compose.override.yml
# This file is generated by our Rakefile. Do not change it!
version: '2.1'
services:
  frontend:
    build:
      args:
        CONTAINER_USERID: 0

    volumes:
      - ./docker-files/home/.bash_history:/home/frontend/.bash_history:Z
      - ./docker-files/home/.irb_history:/home/frontend/.irb_history:Z
      - ./docker-files/home/.pry_history:/home/frontend/.pry_history:Z
      - ./docker-files/home/.irbrc:/home/frontend/.irbrc:Z
      - ./docker-files/home/.pryrc:/home/frontend/.pryrc:Z
EOF
cat << EOF > docker-compose.minitest-user.yml
# This file is generated by our Rakefile. Do not change it!
version: '2.1'
services:
  minitest:
    build:
      args:
        CONTAINER_USERID: 0

EOF
docker-compose build --pull frontend
Building frontend
Step 1/13 : FROM registry.opensuse.org/obs/server/unstable/containers/containers/openbuildservice/frontend-features:latest
latest: Pulling from obs/server/unstable/containers/containers/openbuildservice/frontend-features
Digest: sha256:856bd3e9fd0bb0628e20b143d7e31f9dca9e4165373dc8a7d581ee295205867b
Status: Image is up to date for registry.opensuse.org/obs/server/unstable/containers/containers/openbuildservice/frontend-features:latest
 ---> 03e0a00a250a
Step 2/13 : ARG CONTAINER_USERID
 ---> Using cache
 ---> c0ab2b29cec3
Step 3/13 : RUN npm install -g jshint
 ---> Using cache
 ---> a52ad55c479b
Step 4/13 : RUN gem install --no-format-executable brakeman --version 5.1.1
 ---> Using cache
 ---> e70101b6b74e
Step 5/13 : RUN usermod -u $CONTAINER_USERID frontend
 ---> Running in 7dc539b3f592
usermod: UID '0' already exists
ERROR: Service 'frontend' failed to build: The command '/bin/sh -c usermod -u $CONTAINER_USERID frontend' returned a non-zero code: 4
docker-compose stop
rake aborted!
Command failed with status (1): [docker-compose build --pull frontend...]
/root/open-build-service/Rakefile:35:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
Tasks: TOP => docker:build
(See full trace by running task with --trace)
docker-compose --version
docker-compose version 1.25.0, build unknown
ruby --version
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
rake --version
rake, version 13.0.6
eduardoj commented 2 years ago

It seems you are trying to run rake docker:build with the root user. Please use a normal user belonging to the group docker to setup the development environment. Instructions on how to do this for openSUSE are here, as the developer documentation describes.

amidevous commented 2 years ago

I also tried with a normal user

seen who talks about ui 0 and precisely yes the ui is the root

but it returns another error

but I didn't know who have a docker group

I'm not used to using this and I can't install suse on the server because there are other dependencies that depend on ubuntu

I will try but it should be clearly specified on the CONTRIBUTING.md

if it is necessary as well as the url of the git and note is not good

it is

git clone --depth 1 http://github.com/openSUSE/open-build-service.git

and no

git clone --depth 1 git@github.com:openSUSE/open-build-service.git

only project admins can make a clone in ssh

well I'll try to see for the docker group I'll tell you in a few minutes if it worked

amidevous commented 2 years ago

no it's the same it doesn't work it puts this error

rake docker:build
git config commit.template .gitmessage
touch docker-files/home/.bash_history docker-files/home/.irb_history docker-files/home/.pry_history
cat << EOF > docker-compose.override.yml
# This file is generated by our Rakefile. Do not change it!
version: '2.1'
services:
  frontend:
    build:
      args:
        CONTAINER_USERID: 1000

    volumes:
      - ./docker-files/home/.bash_history:/home/frontend/.bash_history:Z
      - ./docker-files/home/.irb_history:/home/frontend/.irb_history:Z
      - ./docker-files/home/.pry_history:/home/frontend/.pry_history:Z
      - ./docker-files/home/.irbrc:/home/frontend/.irbrc:Z
      - ./docker-files/home/.pryrc:/home/frontend/.pryrc:Z
EOF
cat << EOF > docker-compose.minitest-user.yml
# This file is generated by our Rakefile. Do not change it!
version: '2.1'
services:
  minitest:
    build:
      args:
        CONTAINER_USERID: 1000

EOF
docker-compose build --pull frontend
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
docker-compose stop
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
rake aborted!
Command failed with status (1): [docker-compose stop...]
/home/amidevous/open-build-service/Rakefile:42:in `ensure in block (2 levels) in <top (required)>'
/home/amidevous/open-build-service/Rakefile:42:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'

Caused by:
Command failed with status (1): [docker-compose build --pull frontend...]
/home/amidevous/open-build-service/Rakefile:35:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
Tasks: TOP => docker:build
(See full trace by running task with --trace)
systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-07-06 20:31:14 CEST; 4h 39min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 1138 (dockerd)
      Tasks: 14
     Memory: 114.4M
     CGroup: /system.slice/docker.service
             └─1138 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
danidoni commented 2 years ago

This looks like you don't have permission to interact with docker. Check that your user is present in the docker group: type groups in a terminal and check that docker is present in the command output. If not, please add your user to the docker group, log out, log in, and try the rake docker:build again.

hennevogel commented 2 years ago

If you have any other problem please talk to your local docker support...