P
P
Pavel Novikov2018-09-10 23:22:48
Docker
Pavel Novikov, 2018-09-10 23:22:48

Why can't I add a repository to a Docker container?

When trying to build a container in Docker, I encountered such a problem that the build crashes on the line

RUN add-apt-repository ppa:ondrej/php

with an error
ERROR: Service 'docker_test' failed to build: The command '/bin/sh -c add-apt-repository ppa:ondrej/php' returned a non-zero code: 1

Dockerfile looks like this
FROM ubuntu:16.04
MAINTAINER author<[email protected]>
ENV DEBIAN_FRONTEND noninteractive
RUN gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 94558F59
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:ondrej/php
RUN apt-get update
RUN apt-get install -y — force-yes curl
RUN apt-get install -y apache2
RUN apt-get install -y — allow-unauthenticated php7.2 php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml
RUN rm -rf /var/lib/apt/lists/*

What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2018-09-11
@paulfcdd


WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:
# LC_ALL=C.UTF-8 add- apt-repository ppa:ondrej/php
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Try setting the environment variable LC_ALL=C.UTF-8
Well and the -y switch to the add-apt-repository command to avoid unnecessary questions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question