Skip to content

Commit

Permalink
Set edgehubuser uid and use ContainerUser on windows (#958)
Browse files Browse the repository at this point in the history
* Set uid 1000 and use ContainerUser on windows arm
  • Loading branch information
ancaantochi committed Mar 14, 2019
1 parent 9cd339d commit cf40c16
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion edge-hub/docker/linux/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ RUN apk update && \
apk add --no-cache snappy libcap

# Add an unprivileged user account for running Edge Hub
RUN adduser -Ds /bin/sh edgehubuser
ARG EDGEHUBUSER_ID=1000
RUN adduser -Ds /bin/sh -u ${EDGEHUBUSER_ID} edgehubuser

# Add the CAP_NET_BIND_SERVICE capability to the dotnet binary because
# we are starting Edge Hub as a non-root user
Expand Down
3 changes: 1 addition & 2 deletions edge-hub/docker/windows/arm32v7/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG base_tag=1.0.0-windows-arm32v7
ARG base_tag=1.0.1-windows-arm32v7
ARG base_registry
FROM ${base_registry}/azureiotedge/azureiotedge-hub-base:${base_tag}

Expand All @@ -13,7 +13,6 @@ EXPOSE 8883/tcp
EXPOSE 5671/tcp
EXPOSE 443/tcp

USER edgehubuser
ENV OptimizeForPerformance false
ENV MqttEventsProcessorThreadCount 1
CMD ["dotnet", "Microsoft.Azure.Devices.Edge.Hub.Service.dll"]
5 changes: 2 additions & 3 deletions edge-hub/docker/windows/arm32v7/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ RUN curl -SL %DOTNET_DOWNLOAD_URL% --output dotnet.zip \
USER ContainerAdministrator
# In order to set system PATH, ContainerAdministrator must be used
RUN setx /M PATH "%PATH%;C:\Program Files\dotnet"
# Add an unprivileged user account for running Edge Hub
RUN net user /add edgehubuser
USER edgehubuser

USER ContainerUser

# Configure Kestrel web server to bind to port 80 when present
ENV ASPNETCORE_URLS=http://+:80
Expand Down

0 comments on commit cf40c16

Please sign in to comment.