Windows에 Docker를 설치하는 방법에 대한 코드 예제 공유

黄舟
풀어 주다: 2017-06-07 09:37:04
원래의
2013명이 탐색했습니다.

Windows용 Docker 다운로드

안정적인 버전

Windows용 Docker 설치 준비
설치하기 전에 Windows10 버전이 1703 이상인지, OS 버전이 15063 이상인지 확인하세요
설치할 때 버전 1607에서는 참조 어셈블리 파일을 찾을 수 없습니다. 오류
Windows용 Docker가 작동하려면 Hyper-V 패키지를 활성화해야 합니다. 시스템이 이러한 요구 사항을 충족하지 않는 경우 Hyper-V 대신 Oracle Virtual Box를 사용하는 Docker Toolbox를 설치할 수 있습니다.
Windows 10에 Hyper-V URL 설치

Windows용 Docker 설치
InstallDocker.msi를 두 번 클릭하여 설치 프로그램을 실행하세요.

Docker 확인
PowerShell을 열고 다음 코드를 입력하세요.

PS C:\Users\Docker> docker --version
Docker version 17.03.0-ce, build 60ccb22

PS C:\Users\Docker> docker-compose --version
docker-compose version 1.11.2, build dfed245

PS C:\Users\Docker> docker-machine --version
docker-machine version 0.10.0, build 76ed2a6
로그인 후 복사

docker run hello-world를 실행하여 Docker Hub에서 이미지 가져오기 및 컨테이너 시작을 테스트하세요.

PS C:\Users\jdoe> docker run hello-world
로그인 후 복사
Hello from Docker. This message shows that your installation appears
to be working correctly.
To generate this message, Docker took the following steps:
The Docker client contacted the Docker daemon.
The Docker daemon pulled the "hello-world" image from the Docker Hub.
The Docker daemon created a new container from that image which runs the executable that produces the output you are currently
reading.
The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
로그인 후 복사

좀 더 야심찬 작업을 시도하고 이 명령을 사용하여 Ubuntu 컨테이너를 실행해 보세요.
우분투 컨테이너 이미지를 다운로드하고 시작합니다. 다음은 powershell에서 이 명령을 실행한 결과입니다.

PS C:Usersjdoe> docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally latest: Pulling from
library/ubuntu 5a132a7e7af1: Pull complete fd2731e4c50c: Pull complete
28a2f68d1120: Pull complete a3ed95caeb02: Pull complete Digest:
sha256:4e85ebe01d056b43955250bbac22bdb8734271122e3c78d21e55ee235fc6802d
Status: Downloaded newer image for ubuntu:latest
로그인 후 복사

docker를 사용하여 nginx 서버 시작

PS C:\Users\jdoe> docker run -d -p 80:80 --name webserver nginx
로그인 후 복사
Unable to find image 'nginx:latest' locally latest: Pulling from
library/nginx
fdd5d7827f33: Pull complete a3ed95caeb02: Pull complete 716f7a5f3082:
Pull complete 7b10f03a0309: Pull complete Digest:
sha256:f6a001272d5d324c4c9f3f183e1b69e9e0ff12debeb7a092730d638c33e0de3e
Status: Downloaded newer image for nginx:latest
dfe13c68b3b86f01951af617df02be4897184cbf7a8b4d5caf1c3c5bd3fc267f
访问http://localhost/以显示nginx起始页。
로그인 후 복사

docker ps 명령을 사용하여 컨테이너 목록 보기
docker Images 명령을 사용하여 이미지 목록 보기

Accelerator

트레이의 오른쪽 클릭 메뉴에서 설정 선택 시스템 오른쪽 하단에 있는 아이콘을 클릭하고 구성 창을 열고 왼쪽으로 이동하여 메뉴에서 Docker Daemon을 선택합니다. 창에서 JSON 문자열을 편집하고 다음과 같이 Alibaba Cloud, DaoCloud 등과 같은 액셀러레이터 주소를 입력합니다.

 {
     "registry-mirrors": [
       "https://sr5arhkn.mirror.aliyuncs.com",
       "http://14d216f4.m.daocloud.io"
     ],
     "insecure-registries": []
   }
로그인 후 복사

위 내용은 Windows에 Docker를 설치하는 방법에 대한 코드 예제 공유의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!