Setting Up Docker on Windows 10
- #Docker
- #Tips
- #Know-how
- 2018/09/10
Environment
Windows 10 Pro 64-bit + Docker for Windows.
Installation steps
- Open Control Panel → Programs and Features → Turn Windows features on or off, and enable Hyper-V.
- Windows prompts for a reboot—go ahead and restart.
- Download Docker for Windows from the release notes page and install it.
- After installation, run
docker versionin Command Prompt. If version info prints, everything is set.
Using Docker
- Run
docker run hello-worldto create your first container. Seeing “Hello from Docker!” means the container was created locally. - Next run
docker run -it ubuntu bashand make sure you drop into a bash shell (you can try commands there). Typeexitto leave. - Pull an image from Docker Hub. Here we will grab nginx:
docker pull nginx
List images with:
docker images
- Start nginx with
docker run -d -p 80:80 --name mynginx nginx. - Visit http://localhost:80/ and confirm the server is up—you should see “Welcome to nginx!”.
Tips
docker psshows running containers, anddocker ps -alists all containers.- Stop the server with
docker stop mynginx, then hit http://localhost:80/ again to confirm it is down.
Share:
X (Twitter)