add-apt-repository issue in Ubuntu Trusty containers #5383

Closed
itwars opened this Issue Apr 24, 2014 · 13 comments

Projects

None yet

9 participants

@itwars
itwars commented Apr 24, 2014

Hi,

I need to use ppa repo in a Ubuntu Trusty Container, using that bunch of commands

FROM ubuntu

RUN apt-get update
RUN apt-get -y dist-upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python-software-properties
RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:chris-lea/node.js

And got this message at the very end:

/bin/sh: 1: add-apt-repository: not found

As I don't ask for a specific Ubuntu version it used the last one i.e.: Trusty. But if I ask:

FROM ubuntu:precise

Everything is OK!

Any concerns with Trusty?

Thx
Vincent

@tianon
Member
tianon commented Apr 24, 2014

It looks like the script you're looking for moved from "python-software-properties" into "software-properties-common". Can you try installing "software-properties-common" instead and see if that helps?

@itwars
itwars commented Apr 25, 2014

Hi tianon,

That's it! You solved my issue! But, on Ubuntu bare metal with only python-software-properties it does work?

Anyway ๐Ÿ‘

 # Dockerfile for Nodejs

FROM ubuntu

MAINTAINER Vincent RABAH <xxxx@yyyy.com>

RUN apt-get update
RUN apt-get dist-upgrade -y

RUN DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python-software-properties
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common
RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:chris-lea/node.js
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
@itwars itwars closed this Apr 25, 2014
@tianon
Member
tianon commented May 5, 2014

I believe it changed in trusty (14.04), so unless your bare metal machines are also trusty, they would still have the command in the older package.

@troyfolger troyfolger referenced this issue in monokrome/docker-wine Jan 26, 2015
Closed

Dockerfile broken with current Ubuntu #3

@note89
note89 commented Nov 1, 2015

why dont you put
DEBIAN_FRONTEND=noninteractive
As and enviroment variable instead ?
ENV DEBIAN_FRONTEND=noninteractive

@thaJeztah
Member

@Niler851 those ENV vars will persist in the image, and inherited by images using FROM theimage, which may lead to unexpected results (e.g. If I run the image interactively and no dialogs are shown, because it thinks it's run non-interactively)

@note89
note89 commented Nov 1, 2015

Tnx you that is very good information. then i will change it in my container. tnx you

@borromeotlhs

So what is the resolution on this? install one or both of:
python-software-properties
software-properties-common

Or something else entirely?

@rotelando

@borromeotlhs software-properties-common for newer versions of ubuntu (starting from 14.04). It worked for me. Been trying python-software-properties and it hasn't been working until I used that command

@ttibau
ttibau commented May 31, 2016

what is DEBIAN_FRONTEND=noninteractive??

@thaJeztah
Member

@ttibau it's an environment variable to tell installers that you're installing non-interactive; for example, some packages may normally show a pop up window asking for input; if you set that environment variable, the installer will use the default option, and don't ask / show the pop up.

@psychok7 psychok7 referenced this issue in psychok7/django-yadpt-starter Jun 9, 2016
Closed

Aborting because of server version mismatch #1

@saady
saady commented Jul 5, 2016 edited
FROM ubuntu:14.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
    && apt-get install -y \
    git-core \
    build-essential \
    gperf \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*


RUN apt-get install -y software-properties-common \
    && add-apt-repository ppa:maxmind/ppa \
    && apt-get update \
    && apt-get install libmaxminddb0 libmaxminddb-dev mmdb-bin

it gives me this message error

E: Unable to locate package software-properties-common

is there a way to keep only sources for software-properties-common because
&& rm -rf /var/lib/apt/lists/* remove all the sources.

@saady
saady commented Jul 5, 2016 edited

I tried this

`FROM ubuntu:14.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
    && apt-get install -y \
    git-core \
    build-essential \
    gperf \
    && apt-get clean \
    #&& rm -rf /var/lib/apt/lists/*


RUN apt-get install -y software-properties-common \
    && add-apt-repository ppa:maxmind/ppa \
    && apt-get update \
    && apt-get install libmaxminddb0 libmaxminddb-dev mmdb-bin`

but it always gives /bin/sh: 1: add-apt-repository: not found

@schallertd
schallertd commented Aug 9, 2016 edited

@Niler851 those ENV vars will persist in the image, and inherited by images using FROM theimage, which may lead to unexpected results (e.g. If I run the image interactively and no dialogs are shown, because it thinks it's run non-interactively)

You could use ARG DEBIAN_FRONTEND=noninteractive instead of ENV. The ARG directive sets variables that only live during the build. I think this is what you're looking for.

https://docs.docker.com/engine/reference/builder/#/arg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment