VOL-1763 - correct Dockerfile lint issues, and add docker lint to Makefile

Change-Id: I5f9ed6774e8da10b1bfa5a6b817649bbe5c8951a
diff --git a/Makefile b/Makefile
index 64a8621..63d2f35 100644
--- a/Makefile
+++ b/Makefile
@@ -84,6 +84,7 @@
 	@echo "clean                : Remove files created by the build and tests"
 	@echo "distclean            : Remove venv directory"
 	@echo "docker-push          : Push the docker images to an external repository"
+	@echo "lint-dockerfile      : Perform static analysis on Dockerfiles"
 	@echo "lint-style           : Verify code is properly gofmt-ed"
 	@echo "lint-sanity          : Verify that 'go vet' doesn't report any issues"
 	@echo "lint-dep             : Verify the integrity of the 'dep' files"
@@ -179,6 +180,18 @@
 
 ## lint and unit tests
 
+PATH:=$(GOPATH)/bin:$(PATH)
+HADOLINT=$(shell PATH=$(GOPATH):$(PATH) which hadolint)
+lint-dockerfile:
+ifeq (,$(shell PATH=$(GOPATH):$(PATH) which hadolint))
+	mkdir -p $(GOPATH)/bin
+	curl -o $(GOPATH)/bin/hadolint -sNSL https://github.com/hadolint/hadolint/releases/download/v1.17.1/hadolint-$(shell uname -s)-$(shell uname -m)
+	chmod 755 $(GOPATH)/bin/hadolint
+endif
+	@echo "Running Dockerfile lint check ..."
+	@hadolint $$(find . -name "Dockerfile.*")
+	@echo "Dockerfile lint check OK"
+
 lint-style:
 ifeq (,$(shell which gofmt))
 	go get -u github.com/golang/go/src/cmd/gofmt
@@ -202,7 +215,7 @@
 	@dep check
 	@echo "Dependency check OK"
 
-lint: lint-style lint-sanity lint-dep
+lint: lint-style lint-sanity lint-dep lint-dockerfile
 
 GO_JUNIT_REPORT:=$(shell which go-junit-report)
 GOCOVER_COBERTURA:=$(shell which gocover-cobertura)
diff --git a/docker/Dockerfile.afrouter b/docker/Dockerfile.afrouter
index 40b5423..a7a6e8c 100644
--- a/docker/Dockerfile.afrouter
+++ b/docker/Dockerfile.afrouter
@@ -18,13 +18,19 @@
 FROM golang:1.12-alpine3.9 AS build-env
 
 # Install required packages
-RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
+RUN apk add --no-cache \
+        wget=1.20.3-r0 \
+        git=2.20.1-r0 \
+        make=4.2.1-r2 \
+        build-base=0.5-r1 \
+        protobuf=3.6.1-r1 \
+        protobuf-dev=3.6.1-r1
 
 # Prepare directory structure
-RUN ["mkdir", "-p", "/build"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+RUN mkdir -p /build \
+        "$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin" \
+        "$GOPATH/src/github.com/opencord" \
+        "$GOPATH/src/github.com/opencord/voltha-go"
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
@@ -50,7 +56,9 @@
 ARG org_opencord_vcs_dirty=unknown
 
 # Build
-RUN cd afrouter && go build -o /build/afrouter \
+WORKDIR $GOPATH/src/github.com/opencord/voltha-go/afrouter
+SHELL ["/bin/ash", "-o", "pipefail", "-c"]
+RUN go build -o /build/afrouter \
 	-ldflags \
 	"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
 	 -X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref  \
diff --git a/docker/Dockerfile.afrouterTest b/docker/Dockerfile.afrouterTest
index 5500156..c88e706 100644
--- a/docker/Dockerfile.afrouterTest
+++ b/docker/Dockerfile.afrouterTest
@@ -18,13 +18,19 @@
 FROM golang:1.12-alpine3.9 AS build-env
 
 # Install required packages
-RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
+RUN apk add --no-cache \
+        wget=1.20.3-r0 \
+        git=2.20.1-r0 \
+        make=4.2.1-r2 \
+        build-base=0.5-r1 \
+        protobuf=3.6.1-r1 \
+        protobuf-dev=3.6.1-r1
 
 # Prepare directory structure
-RUN ["mkdir", "-p", "/build"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+RUN mkdir -p /build \
+        "$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin" \
+        "$GOPATH/src/github.com/opencord" \
+        "$GOPATH/src/github.com/opencord/voltha-go"
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
@@ -55,7 +61,9 @@
 ARG org_opencord_vcs_dirty=unknown
 
 # Build
-RUN cd afrouter && go build --tags integration -o /build/afrouter \
+WORKDIR $GOPATH/src/github.com/opencord/voltha-go/afrouter
+SHELL ["/bin/ash", "-o", "pipefail", "-c"]
+RUN go build --tags integration -o /build/afrouter \
 	-ldflags \
 	"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
 	 -X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref  \
@@ -65,18 +73,20 @@
 	 -X github.com/opencord/voltha-go/common/version.arch=$(go env GOHOSTARCH) \
 	 -X github.com/opencord/voltha-go/common/version.buildTime=$org_label_schema_build_date"
 
-RUN cd tests/afrouter && go build --tags integration -o /build/afrouterTest \
+WORKDIR $GOPATH/src/github.com/opencord/voltha-go/tests./afrouter
+RUN go build --tags integration -o /build/afrouterTest \
 	-ldflags \
 	"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
 	 -X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref  \
 	 -X github.com/opencord/voltha-go/common/version.vcsDirty=$org_opencord_vcs_dirty \
 	 -X github.com/opencord/voltha-go/common/version.goVersion=$(go version 2>&1 | sed -E  's/.*go([0-9]+\.[0-9]+\.[0-9]+).*/\1/g') \
-	 -X github.com/opencord/voltha-go/common/version.os=$(uname -s | tr A-Z a-z) \
-	 -X github.com/opencord/voltha-go/common/version.arch=$(uname -m | tr A-Z a-z) \
+	 -X github.com/opencord/voltha-go/common/version.os=$(uname -s | tr "[:upper:]" "[:lower:]") \
+	 -X github.com/opencord/voltha-go/common/version.arch=$(uname -m | tr "[:upper:]" "[:lower:]") \
 	 -X github.com/opencord/voltha-go/common/version.buildTime=$org_label_schema_build_date"
 
 # Run tests
-RUN cd /build/tests/suites && /build/afrouterTest -config main.json -logLevel 1
+WORKDIR /build/tests/suites
+RUN /build/afrouterTest -config main.json -logLevel 1
 
 # -------------
 # Image creation stage
@@ -94,7 +104,7 @@
 COPY --from=build-env /build/tests /app/tests/
 COPY --from=build-env /src/tests /app/tests/
 
-CMD tests/runAll tests
+CMD ["tests/runAll", "tests"]
 
 # Label image
 ARG org_label_schema_version=unknown
diff --git a/docker/Dockerfile.afrouterd b/docker/Dockerfile.afrouterd
index 6401b24..2a0be94 100644
--- a/docker/Dockerfile.afrouterd
+++ b/docker/Dockerfile.afrouterd
@@ -18,13 +18,19 @@
 FROM golang:1.12-alpine3.9 AS build-env
 
 # Install required packages
-RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
+RUN apk add --no-cache \
+        wget=1.20.3-r0 \
+        git=2.20.1-r0 \
+        make=4.2.1-r2 \
+        build-base=0.5-r1 \
+        protobuf=3.6.1-r1 \
+        protobuf-dev=3.6.1-r1
 
 # Prepare directory structure
-RUN ["mkdir", "-p", "/build"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+RUN mkdir -p /build \
+        "$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin" \
+        "$GOPATH/src/github.com/opencord" \
+        "$GOPATH/src/github.com/opencord/voltha-go"
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
@@ -50,7 +56,9 @@
 ARG org_opencord_vcs_dirty=unknown
 
 # Build
-RUN cd arouterd && go build -o /build/arouterd \
+WORKDIR $GOPATH/src/github.com/opencord/voltha-go/arouterd
+SHELL ["/bin/ash", "-o", "pipefail", "-c"]
+RUN go build -o /build/arouterd \
 	-ldflags \
 	"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
 	 -X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref  \
diff --git a/docker/Dockerfile.ro_core b/docker/Dockerfile.ro_core
index 1fbabe0..511e913 100644
--- a/docker/Dockerfile.ro_core
+++ b/docker/Dockerfile.ro_core
@@ -18,13 +18,19 @@
 FROM golang:1.12-alpine3.9 AS build-env
 
 # Install required packages
-RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
+RUN apk add --no-cache \
+        wget=1.20.3-r0 \
+        git=2.20.1-r0 \
+        make=4.2.1-r2 \
+        build-base=0.5-r1 \
+        protobuf=3.6.1-r1 \
+        protobuf-dev=3.6.1-r1
 
 # Prepare directory structure
-RUN ["mkdir", "-p", "/build"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+RUN mkdir -p /build \
+        "$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin" \
+        "$GOPATH/src/github.com/opencord" \
+        "$GOPATH/src/github.com/opencord/voltha-go"
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
@@ -45,7 +51,9 @@
 ARG org_opencord_vcs_dirty=unknown
 
 # Build
-RUN cd ro_core && go build -o /build/ro_core \
+WORKDIR $GOPATH/src/github.com/opencord/voltha-go/ro_core
+SHELL ["/bin/ash", "-o", "pipefail", "-c"]
+RUN go build -o /build/ro_core \
 	-ldflags \
 	"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
 	 -X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref  \
diff --git a/docker/Dockerfile.rw_core b/docker/Dockerfile.rw_core
index 96c7679..3daab28 100644
--- a/docker/Dockerfile.rw_core
+++ b/docker/Dockerfile.rw_core
@@ -18,13 +18,19 @@
 FROM golang:1.12-alpine3.9 AS build-env
 
 # Install required packages
-RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
+RUN apk add --no-cache \
+	wget=1.20.3-r0 \
+	git=2.20.1-r0 \
+	make=4.2.1-r2 \
+	build-base=0.5-r1 \
+	protobuf=3.6.1-r1 \
+	protobuf-dev=3.6.1-r1
 
 # Prepare directory structure
-RUN ["mkdir", "-p", "/build"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+RUN mkdir -p /build \
+	"$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin" \
+	"$GOPATH/src/github.com/opencord" \
+	"$GOPATH/src/github.com/opencord/voltha-go"
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
@@ -45,7 +51,9 @@
 ARG org_opencord_vcs_dirty=unknown
 
 # Build
-RUN cd rw_core && go build -o /build/rw_core \
+WORKDIR $GOPATH/src/github.com/opencord/voltha-go/rw_core
+SHELL ["/bin/ash", "-o", "pipefail", "-c"]
+RUN go build -o /build/rw_core \
 	-ldflags \
 	"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
 	 -X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref  \
diff --git a/docker/Dockerfile.simulated_olt b/docker/Dockerfile.simulated_olt
index 2cf9ba2..d31cf48 100644
--- a/docker/Dockerfile.simulated_olt
+++ b/docker/Dockerfile.simulated_olt
@@ -18,13 +18,19 @@
 FROM golang:1.12-alpine3.9 AS build-env
 
 # Install required packages
-RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
+RUN apk add --no-cache \
+        wget=1.20.3-r0 \
+        git=2.20.1-r0 \
+        make=4.2.1-r2 \
+        build-base=0.5-r1 \
+        protobuf=3.6.1-r1 \
+        protobuf-dev=3.6.1-r1
 
 # Prepare directory structure
-RUN ["mkdir", "-p", "/build"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+RUN mkdir -p /build \
+        "$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin" \
+        "$GOPATH/src/github.com/opencord" \
+        "$GOPATH/src/github.com/opencord/voltha-go"
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
@@ -47,7 +53,9 @@
 ARG org_opencord_vcs_dirty=unknown
 
 # Build
-RUN cd adapters/simulated_olt && go build -o /build/simulated_olt \
+WORKDIR $GOPATH/src/github.com/opencord/voltha-go/adapters/simulated_olt
+SHELL ["/bin/ash", "-o", "pipefail", "-c"]
+RUN go build -o /build/simulated_olt \
 	-ldflags \
 	"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
 	 -X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref  \
diff --git a/docker/Dockerfile.simulated_onu b/docker/Dockerfile.simulated_onu
index 911bd4d..3c66d33 100644
--- a/docker/Dockerfile.simulated_onu
+++ b/docker/Dockerfile.simulated_onu
@@ -18,13 +18,19 @@
 FROM golang:1.12-alpine3.9 AS build-env
 
 # Install required packages
-RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
+RUN apk add --no-cache \
+        wget=1.20.3-r0 \
+        git=2.20.1-r0 \
+        make=4.2.1-r2 \
+        build-base=0.5-r1 \
+        protobuf=3.6.1-r1 \
+        protobuf-dev=3.6.1-r1
 
 # Prepare directory structure
-RUN ["mkdir", "-p", "/build"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+RUN mkdir -p /build \
+        "$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin" \
+        "$GOPATH/src/github.com/opencord" \
+        "$GOPATH/src/github.com/opencord/voltha-go"
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
@@ -47,7 +53,9 @@
 ARG org_opencord_vcs_dirty=unknown
 
 # Build
-RUN cd adapters/simulated_onu && go build -o /build/simulated_onu \
+WORKDIR $GOPATH/src/github.com/opencord/voltha-go/adapters/simulated_onu
+SHELL ["/bin/ash", "-o", "pipefail", "-c"]
+RUN go build -o /build/simulated_onu \
 	-ldflags \
 	"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
 	 -X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref  \
diff --git a/python/docker/Dockerfile.adapter_ponsim_olt b/python/docker/Dockerfile.adapter_ponsim_olt
index d5d1bf0..de1851f 100644
--- a/python/docker/Dockerfile.adapter_ponsim_olt
+++ b/python/docker/Dockerfile.adapter_ponsim_olt
@@ -15,7 +15,20 @@
 
 # Update to have latest images
 RUN apt-get update && \
-    apt-get install -y python openssl iproute2 libpcap-dev wget build-essential git binutils python-dev libffi-dev libssl-dev
+    apt-get install -y --no-install-recommends \
+	ca-certificates=20170717~16.04.2 \
+        python=2.7.12-1~16.04 \
+        openssl=1.0.2g-1ubuntu4.15 \
+        iproute2=4.3.0-1ubuntu3.16.04.5 \
+        libpcap-dev=1.7.4-2 \
+        wget=1.17.1-1ubuntu1.5 \
+        build-essential=12.1ubuntu2 \
+        git=1:2.7.4-0ubuntu1.6 \
+        binutils=2.26.1-1ubuntu1~16.04.8 \
+        python-dev=2.7.12-1~16.04 \
+        libffi-dev=3.2.1-4 \
+        libssl-dev=1.0.2g-1ubuntu4.15 \
+        && apt-get clean && rm -rf /var/lib/apt/lists/*
 
 # Install current version of pip rather than outdated pip from apt
 RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
@@ -29,11 +42,11 @@
 ARG LOCAL_PROTOS
 COPY local_imports/ /local_imports/
 RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \
-    pip install /local_imports/pyvoltha/dist/*.tar.gz ; \
+    pip install /local_imports/pyvoltha/dist/*.tar.gz==* ; \
 fi
 
 RUN if [ -n "$LOCAL_PROTOS" ] ; then \
-    pip install /local_imports/voltha-protos/dist/*.tar.gz ; \
+    pip install /local_imports/voltha-protos/dist/*.tar.gz==* ; \
 fi
 
 # Bundle app source
diff --git a/python/docker/Dockerfile.adapter_ponsim_onu b/python/docker/Dockerfile.adapter_ponsim_onu
index 10c8ef2..21cd0e6 100644
--- a/python/docker/Dockerfile.adapter_ponsim_onu
+++ b/python/docker/Dockerfile.adapter_ponsim_onu
@@ -15,7 +15,20 @@
 
 # Update to have latest images
 RUN apt-get update && \
-    apt-get install -y python openssl iproute2 libpcap-dev wget build-essential git binutils python-dev libffi-dev libssl-dev
+    apt-get install -y --no-install-recommends \
+	ca-certificates=20170717~16.04.2 \
+        python=2.7.12-1~16.04 \
+        openssl=1.0.2g-1ubuntu4.15 \
+        iproute2=4.3.0-1ubuntu3.16.04.5 \
+        libpcap-dev=1.7.4-2 \
+        wget=1.17.1-1ubuntu1.5 \
+        build-essential=12.1ubuntu2 \
+        git=1:2.7.4-0ubuntu1.6 \
+        binutils=2.26.1-1ubuntu1~16.04.8 \
+        python-dev=2.7.12-1~16.04 \
+        libffi-dev=3.2.1-4 \
+        libssl-dev=1.0.2g-1ubuntu4.15 \
+        && apt-get clean && rm -rf /var/lib/apt/lists/*
 
 # Install current version of pip rather than outdated pip from apt
 RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
@@ -29,11 +42,11 @@
 ARG LOCAL_PROTOS
 COPY local_imports/ /local_imports/
 RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \
-    pip install /local_imports/pyvoltha/dist/*.tar.gz ; \
+    pip install /local_imports/pyvoltha/dist/*.tar.gz==* ; \
 fi
 
 RUN if [ -n "$LOCAL_PROTOS" ] ; then \
-    pip install /local_imports/voltha-protos/dist/*.tar.gz ; \
+    pip install /local_imports/voltha-protos/dist/*.tar.gz==* ; \
 fi
 
 # Bundle app source
diff --git a/python/docker/Dockerfile.cli b/python/docker/Dockerfile.cli
index fa9e845..11a3a81 100644
--- a/python/docker/Dockerfile.cli
+++ b/python/docker/Dockerfile.cli
@@ -15,7 +15,21 @@
 
 # Update to have latest images
 RUN apt-get update && \
-    apt-get install -y python openssl iproute2 libpcap-dev wget build-essential git binutils python-dev libffi-dev libssl-dev
+    apt-get install -y --no-install-recommends \
+        ca-certificates=20170717~16.04.2 \
+        python=2.7.12-1~16.04 \
+        openssl=1.0.2g-1ubuntu4.15 \
+        iproute2=4.3.0-1ubuntu3.16.04.5 \
+        libpcap-dev=1.7.4-2 \
+        wget=1.17.1-1ubuntu1.5 \
+        build-essential=12.1ubuntu2 \
+        git=1:2.7.4-0ubuntu1.6 \
+        binutils=2.26.1-1ubuntu1~16.04.8 \
+        python-dev=2.7.12-1~16.04 \
+        libffi-dev=3.2.1-4 \
+        libssl-dev=1.0.2g-1ubuntu4.15 \
+	openssh-server=1:7.2p2-4ubuntu2.8 \
+        && apt-get clean && rm -rf /var/lib/apt/lists/*
 
 # Install current version of pip rather than outdated pip from apt
 RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
@@ -29,11 +43,11 @@
 ARG LOCAL_PROTOS
 COPY local_imports/ /local_imports/
 RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \
-    pip install /local_imports/pyvoltha/dist/*.tar.gz ; \
+    pip install /local_imports/pyvoltha/dist/*.tar.gz==* ; \
 fi
 
 RUN if [ -n "$LOCAL_PROTOS" ] ; then \
-    pip install /local_imports/voltha-protos/dist/*.tar.gz ; \
+    pip install /local_imports/voltha-protos/dist/*.tar.gz==* ; \
 fi
 
 # Bundle app source
@@ -44,12 +58,11 @@
 RUN touch /voltha/python/cli/__init__.py
 
 # Setup the voltha user
+SHELL ["/bin/bash", "-o", "pipefail", "-c"]
 RUN useradd -b /home -d /home/voltha voltha -s /bin/bash
 RUN mkdir /home/voltha
 RUN chown voltha.voltha /home/voltha
 RUN echo "voltha:admin" | chpasswd
-RUN apt-get update && apt-get install -y openssh-server
-RUN apt-get update && apt-get install -y openssh-server
 RUN mkdir /var/run/sshd
 RUN echo 'root:screencast' | chpasswd
 RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
diff --git a/python/docker/Dockerfile.ofagent b/python/docker/Dockerfile.ofagent
index 2037fa0..d5717ff 100644
--- a/python/docker/Dockerfile.ofagent
+++ b/python/docker/Dockerfile.ofagent
@@ -15,7 +15,20 @@
 
 # Update to have latest images
 RUN apt-get update && \
-    apt-get install -y python openssl iproute2 libpcap-dev wget build-essential git binutils python-dev libffi-dev libssl-dev
+    apt-get install -y --no-install-recommends \
+        ca-certificates=20170717~16.04.2 \
+	python=2.7.12-1~16.04 \
+	openssl=1.0.2g-1ubuntu4.15 \
+	iproute2=4.3.0-1ubuntu3.16.04.5 \
+	libpcap-dev=1.7.4-2 \
+	wget=1.17.1-1ubuntu1.5 \
+	build-essential=12.1ubuntu2 \
+	git=1:2.7.4-0ubuntu1.6 \
+	binutils=2.26.1-1ubuntu1~16.04.8 \
+	python-dev=2.7.12-1~16.04 \
+	libffi-dev=3.2.1-4 \
+	libssl-dev=1.0.2g-1ubuntu4.15 \
+	&& apt-get clean && rm -rf /var/lib/apt/lists/*
 
 # Install current version of pip rather than outdated pip from apt
 RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
@@ -29,16 +42,16 @@
 ARG LOCAL_PROTOS
 COPY local_imports/ /local_imports/
 RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \
-    pip install /local_imports/pyvoltha/dist/*.tar.gz ; \
+    pip install /local_imports/pyvoltha/dist/*.tar.gz==* ; \
 fi
 
 RUN if [ -n "$LOCAL_PROTOS" ] ; then \
-    pip install /local_imports/voltha-protos/dist/*.tar.gz ; \
+    pip install /local_imports/voltha-protos/dist/*.tar.gz==* ; \
 fi
 
 # Bundle app source
 RUN mkdir /ofagent  && \
-        touch   /ofagent/__init__.py 
+        touch   /ofagent/__init__.py
 
 ENV PYTHONPATH=/ofagent
 COPY ofagent /ofagent/ofagent