diff --git a/install/v2plugin/Dockerfile b/install/v2plugin/Dockerfile index 4d1c3d341..37e989021 100644 --- a/install/v2plugin/Dockerfile +++ b/install/v2plugin/Dockerfile @@ -1,26 +1,14 @@ -## -#Copyright 2017 Cisco Systems Inc. All rights reserved. -# -#Licensed under the Apache License, Version 2.0 (the "License"); -#you may not use this file except in compliance with the License. -#You may obtain a copy of the License at -#http://www.apache.org/licenses/LICENSE-2.0 -# -#Unless required by applicable law or agreed to in writing, software -#distributed under the License is distributed on an "AS IS" BASIS, -#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -#See the License for the specific language governing permissions and -#limitations under the License. -## - # Docker v2plugin container with OVS / netplugin / netmaster -FROM alpine:3.6 +FROM alpine:3.5 LABEL maintainer "Cisco Contiv (https://contiv.github.io)" -RUN mkdir -p /run/docker/plugins /etc/openvswitch /var/log/contiv \ +RUN mkdir -p /run/docker/plugins /etc/openvswitch /var/run/contiv/log \ && echo 'http://dl-cdn.alpinelinux.org/alpine/v3.4/main' >> /etc/apk/repositories \ - && apk --no-cache add openvswitch=2.5.0-r0 iptables ca-certificates openssl curl bash + && apk --no-cache add openvswitch=2.5.0-r0 iptables ca-certificates openssl curl \ + && wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/andyshinn/alpine-pkg-glibc/master/sgerrand.rsa.pub \ + && wget https://github.com/andyshinn/alpine-pkg-glibc/releases/download/2.23-r1/glibc-2.23-r1.apk \ + && apk --no-cache add glibc-2.23-r1.apk COPY netplugin netmaster netctl startcontiv.sh / diff --git a/netplugin/netd.go b/netplugin/netd.go index 63c806fdd..e0bdbf8b7 100755 --- a/netplugin/netd.go +++ b/netplugin/netd.go @@ -19,8 +19,8 @@ import ( "log/syslog" "net/url" "os" + "os/user" "strings" - "syscall" "time" "github.com/contiv/netplugin/core" @@ -181,8 +181,8 @@ func main() { } // Make sure we are running as root - uid := syscall.Getuid() - if uid != 0 { + usr, err := user.Current() + if (err != nil) || (usr.Username != "root") { log.Fatalf("This process can only be run as root") } diff --git a/scripts/build.sh b/scripts/build.sh index 28fe7d75c..5925e9362 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -26,10 +26,10 @@ else fi echo $BUILD_VERSION >$VERSION_FILE -GOGC=1500 CGO_ENABLED=0 go install \ - -a -installsuffix cgo \ + +GOGC=1500 go install \ -ldflags "-X $PKG_NAME.version=$BUILD_VERSION \ -X $PKG_NAME.buildTime=$BUILD_TIME \ -X $PKG_NAME.gitCommit=$GIT_COMMIT \ - -s -w -d" -pkgdir /tmp/foo-cgo \ + -s -w" \ -v $TO_BUILD diff --git a/scripts/netContain/Dockerfile b/scripts/netContain/Dockerfile index bfa8efb2a..5bd715a15 100644 --- a/scripts/netContain/Dockerfile +++ b/scripts/netContain/Dockerfile @@ -13,18 +13,19 @@ #limitations under the License. ## -# One Container for OVS / netplugin / netmaster +# One Container for OVS / netplugin / netmaster -FROM alpine:3.6 -LABEL maintainer "Cisco Contiv (https://contiv.github.io)" +FROM ubuntu:16.04 -# Make sure to Modify the Proxy Server values if required +# Make sure to Modify the Proxy Server values if required # ENV export http_proxy=http://proxy.localhost.com:8080 # ENV export https_proxy=https://proxy.localhost.com:8080 -RUN mkdir -p /etc/openvswitch \ - && echo 'http://dl-cdn.alpinelinux.org/alpine/v3.4/main' >> /etc/apk/repositories \ - && apk --no-cache add openvswitch=2.5.0-r0 iptables ca-certificates openssl curl bash +RUN apt-get update \ + && apt-get install -y openvswitch-switch=2.5.2-0ubuntu0.16.04.1 \ + net-tools \ + iptables \ + && rm -rf /var/lib/apt/lists/* COPY ./bin /contiv/bin/ COPY ./scripts /contiv/scripts/