2015-09-09 15 views
15

Ho appena fatto un semplice file di finestra mobile nel mio terminale, in fondo ho fatto la seguente:apt-add-repository: comando non trovato errore in Dockerfile

mkdir pgrouted 
cd pgrouted 
touch Dockerfile 

Ora ho aperto il file finestra mobile nell'editor nano e aggiungo i seguenti comandi al file finestra mobile:

FROM ubuntu 

MAINTAINER Gautam <[email protected]> 

LABEL Description="pgrouting excercise" Vendor="skanatek" Version="1.0" 

ENV BBOX="-122.8,45.4,-122.5,45.6" 

# Add pgRouting launchpad repository 
RUN sudo apt-add-repository -y ppa:ubuntugis/ppa 
RUN sudo apt-add-repository -y ppa:georepublic/pgrouting 
RUN sudo apt-get update 

# Install pgRouting package (for Ubuntu 14.04) 
RUN sudo apt-get install postgresql-9.3-pgrouting 

# Install osm2pgrouting package 
RUN sudo apt-get install osm2pgrouting 

# Install workshop material (optional, but maybe slightly outdated) 
RUN sudo apt-get install pgrouting-workshop 

# For workshops at conferences and events: 
# Download and install from http://trac.osgeo.org/osgeo/wiki/Live_GIS_Workshop_Install 
RUN wget --no-check-certificate https://launchpad.net/~georepublic/+archive/pgrouting/+files/pgrouting-workshop_2.0.6-ppa1_all.deb 

RUN sudo dpkg -i pgrouting-workshop_2.0.6-ppa1_all.deb 

# review:Not sure weather this should be in the dockerfile 
RUN cp -R /usr/share/pgrouting/workshop ~/Desktop/pgrouting-workshop 

# login as user "user" 
RUN psql -U postgres 

#create routing database 
RUN CREATE DATABASE routing; 

#add PostGIS functions 
RUN CREATE EXTENSION postgis; 

#add pgRouting core functions 
CREATE EXTENSION pgrouting; 

# Download using Overpass XAPI (larger extracts possible than with default OSM API) 
wget --progress=dot:mega -O "sampledata.osm" "http://www.overpass-api.de/api/xapi?*[bbox=${BBOX}][@meta]" 

l'intero Dockerfile può essere vedere HERE a colpo d'occhio.

Ora in cui provo a costruire la dockerfile, in questo modo:

docker build -t gautam/pgrouted:v1 . 

Il dockerfile corre e che ottengo l'errore qui sotto:

Step 4 : RUN sudo apt-add-repository -y ppa:ubuntugis/ppa 
---> Running in c93c3c5fd5e8 
sudo: apt-add-repository: command not found 
The command '/bin/sh -c sudo apt-add-repository -y ppa:ubuntugis/ppa' returned a non-zero code: 1 

qualcuno può dirmi perché sto ottenendo questo errore?

risposta

19

apt-add-repository non è solo nell'immagine di Ubuntu di base. Dovrai prima installarlo. provare apt-get install software-properties-common

Tra l'altro, non è necessario utilizzare sudo nel Dockerfile perché i comandi vengono eseguiti come root di default a meno che non si passa a un altro utente con il comando USER.

+1

ho aggiunto 'pt-get install software-properties-common' come il primo comando RUN pt-get install software-properties-common', così ora ho ricevuto questo errore http://chopapp.com/ # 8a4vdsnw –

+1

a seconda della versione di Ubuntu, può essere 'python-software-properties' o' software-properties-common' – user2915097

+1

su ubuntu 16.04 questo vuole installare 46MiB dati aggiuntivi:/troppo per essere in grado di eseguire un semplice comando. – cweiske