Docker

說明

command

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# download image
docker pull postgres

# list download or create image
docker images
docker images -a

# image save to file(U12 tag)
docker save -o webdemou12.tar joshhu/webdemo:u12
# image load from file
docker load --input webdemou12.tar

# remove download image
docker rmi --no-prune=true joshhu/webdemo:u12
# remove all local image
docker rmi -f $(docker images -aq)

# joshhu/webdemo:latest add tag u14
docker tag joshhu/webdemo:latest joshhu/webdemo:u14

# create new image
# docker build

# upload image
# docker push <username>/<repo name>:<Tag name>
docker push joshhu/webdemo:u12

run

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# pull image
docker pull postgres
# 建立 container,設定 port 號,設定 postgres 登入密碼
docker create --name my-postgres -p 8080:5432 -e POSTGRES_PASSWORD=admin postgres
# 執行 container
docker start my-postgres

# 建立, 執行 container
docker run -d --name my-postgres -p 8080:5432 -e POSTGRES_PASSWORD=admin postgres

# -v : 指定安裝位置
# -d : Detached mode, run command in the background
# postgres module name(配合password)
# --name my-postgres : 建立名稱
docker run --name ithome-postgres -e POSTGRES_PASSWORD=mysecretpassword -v D:\app\docker\ithome\postgres:/var/lib/postgresql/data -d postgres

Issue

Hardware assisted virtualization

Hardware assisted virtualization and data execution protection must be enabled in the BIOS

check virtualization ebnable
check Windows feature on or off

控制台 –> 程式集 –> 解除安裝程式 –> 開啟或關閉 Windows 功能

run powerShell - administrator

bcdedit /set hypervisorlaunchtype auto

reboot windows then run docker

VirtualBox issue

Call to WHvSetupPartition failed: ERROR_SUCCESS

check virtualization ebnable
check Windows feature on or off

控制台 –> 程式集 –> 解除安裝程式 –> 開啟或關閉 Windows 功能

run powerShell - administrator

bcdedit /set hypervisorlaunchtype off

reboot windows then run docker

set virtualBox 6 與 Hyper-V 共存

run command line
1
2
3
4
5
# 設定單一虛擬器
VBoxManage setextradata "<虛擬器名稱>" "VBoxInternal/NEM/UseRing0Runloop" 0

# 設定所有虛擬器
VBoxManage setextradata global "VBoxInternal/NEM/UseRing0Runloop" 0
run PowerShell
1
2
3
4
5
# 設定單一虛擬器
./VBoxManage.exe setextradata "<虛擬器名稱>" "VBoxInternal/NEM/UseRing0Runloop" 0

# 設定所有虛擬器
./VBoxManage.exe setextradata global "VBoxInternal/NEM/UseRing0Runloop" 0

Ref