-1

my docker install my windows10 PC . the below step is which I created the container from the powershell window.

docker run -p 80 --name web -i -t ubuntu /bin/bash
#>apt-get update
#>apt-get install -y nginx

now, I found there are 2 questions when my pc restart.

  1. the container 'web' is not running
  2. when start 'web' container , the 'nginx' service is not running

the first question is resolved:

docker update --restart=always web

but the second question how to do? please help me

amazing
  • 39
  • 7
  • [Docker's official tutorial on building and running custom images](https://docs.docker.com/get-started/part2/) is a good starting point; so is [the official nginx image](https://hub.docker.com/_/nginx/). Installing software in an interactive shell in a Docker container is basically guaranteed to lose work and not be reproducible. – David Maze Jan 27 '19 at 12:26

1 Answers1

2

The best option in your case is running dedicated container for nginx instead of generic ubuntu with nginx being installed each time.

Use following command to run Nginx alpine release:

docker run -p 80 --name web-Nginx -d --restart always nginx:1.15.8-alpine
dongi
  • 378
  • 1
  • 3