Docker Community Forums

Share and learn in the Docker community.

CentOS 7.4 - ERROR: Service 'worker' failed to build: The command '/bin/sh -c sudo yum update' returned a non-zero code: 127

docker

(Levild) #1

I am using docker and docker-compose on a CentOS 7.4.1708 (Core)
Docker version 17.12.1-ce, build 7390fc6
docker-compose version 1.19.0, build 9e633ef

I am getting the ERROR: Service ‘worker’ failed to build: The command ‘/bin/sh -c sudo yum update’ returned a non-zero code: 127

The complete output o screen is like this:

Building worker
Step 1/16 : FROM ruby:2.3.1
—> ffe8239a147c
Step 2/16 : RUN sudo yum update
—> Running in 23f22bb0fbe7
/bin/sh: 1: sudo: not found
ERROR: Service ‘worker’ failed to build: The command ‘/bin/sh -c sudo yum update’ returned a non-zero code: 127

The content of my docker-compose-centos.dev.yml file is:

version: '2’
services:
db:
image: postgres:9.5.4
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: development
POSTGRES_DB: visionkit_development
ports:
- "5432:5432"
mailcatcher:
image: schickling/mailcatcher
ports:
- “1080:1080”

web-bundler-cache:
image: ruby:2.3.1
command: echo 'Data Container for Ruby 2.3.1 bundled gems’
volumes:
- /usr/local/bundle

web:
build:
context: .
dockerfile: Dockerfile-CentOS
volumes:
- .:/app
volumes_from:
- web-bundler-cache
ports:
- "3000:3000"
environment:
RAILS_ENV: development
stdin_open: true
tty: true
links:
- mailcatcher

worker:
build:
context: .
dockerfile: Dockerfile-CentOS
volumes:
- .:/app
volumes_from:
- web-bundler-cache
environment:
- RAILS_ENV=development
stdin_open: true
tty: true
links:
- mailcatcher

redis:
ports:
- “6379:6379”

All are running without hours until the Building worker.

Not sure how to fix this.
In additions the similar scripts for Ubuntu 16.04 using apt-get instead of yum are working perfectly.


(Joffrey F) #2

Build is executed as the root user inside the container, so you don’t need sudo.