How to add registry entries in bulk while building my image using Docker for Windows

0 votes

I’ve installed Docker for Windows and I’m currently building a docker image. This is the Dockerfile:

FROM mydockerhublogin/win2k16-ruby:1.0
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
ADD . /app
# Make port 80 available to the world outside this container
EXPOSE 80
# Define environment variable
ENV NAME World
RUN powershell -Command \
    $ErrorActionPreference = 'Stop'; \
  New-Item "HKLM:\Software\WOW6432Node\ExampleCom" -Force ; \
  New-ItemProperty "HKLM:\Software\WOW6432Node\ExampleCom" -Name MenuLastUpdate -Value "test" -Force
RUN powershell -Command \
    $ErrorActionPreference = 'Stop'; \
  New-Item "HKLM:\Software\ExampleCom" -Force ; \
  New-ItemProperty "HKLM:\Software\ExampleCom" -Name MenuLastUpdate -Value "test" -Force
# Run ruby script when the container launches
CMD ["C:/Ruby23-x64/bin/ruby.exe", "docker_ruby_test.rb"]

I’m adding some registry entries to the Windows registry in the above Dockerfile. But this works when I have a few entries but I have to add a bulk of entries. Is there any other way to do this?  

Nov 26, 2018 in DevOps & Agile by Tyrion anex
• 8,700 points
3,590 views

1 answer to this question.

0 votes

You can create a file for your registry entry and copy it inside the container.

After that, run

 Invoke-Command -ScriptBlock {regedit /i /s C:\shared\settings.reg}

Hope this helps!

answered Nov 26, 2018 by Sophie may
• 10,620 points

Related Questions In DevOps & Agile

0 votes
1 answer

How to a run deployed app in Docker for Windows?

To deploy an ASP.NET web application to ...READ MORE

answered Aug 30, 2018 in DevOps & Agile by Tyrion anex
• 8,700 points
1,228 views
0 votes
1 answer

How to restart docker for windows using Powershell?

Try this: $processes = Get-Process "*docker for windows*" if ...READ MORE

answered Oct 23, 2018 in DevOps & Agile by Tyrion anex
• 8,700 points
7,583 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,737 views
0 votes
1 answer

Error: Unable to access elasticsearch in docker for windows

This is simple, just follow the below ...READ MORE

answered Sep 3, 2018 in DevOps & Agile by Sophie may
• 10,620 points
1,706 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP