Total Pageviews

Showing posts with label Docker. Show all posts
Showing posts with label Docker. Show all posts

2020/02/10

[Docker] 如何將預先準備好的 SQL 檔案,於啟動時匯入 Oracle Docker

1. 確認 Docker 所 mount 的 directory

2. 將準備好的 SQL file(s) 放到特定目錄下



3. 指定 volume,將 sql 所存放的路徑 (i.e. /Users/guojunyou/Documents/docker/local-initdb) 對應到 /etc/entrypoint-initdb.d
docker run -d --shm-size=2g -p 8080:8080 -p 1521:1521 \
-e NLS_LANG="TRADITIONAL CHINESE_TAIWAN.AL32UTF8" \
-v /Users/guojunyou/Documents/docker/local-initdb:/etc/entrypoint-initdb.d \
42dda6eba3ea


Reference
[1] https://hub.docker.com/r/orangehrm/oracle-xe-11g

2020/02/09

[Docker] 如何解決 Oracle Docker 匯入資料繁體中文亂碼問題

Problem
我有準備好 create table 與 insert data 的語法在指定目錄,並用以下指令啟動 docker:
docker run -d --shm-size=1g -p 8080:8080 -p 1521:1521 \
-v /Users/guojunyou/Documents/docker/local-initdb:/etc/entrypoint-initdb.d \
42dda6eba3ea

並成功啟動 Oracle docker
guojunyoude-iMac:~ guojunyou$ docker logs 4445b2acf933 --details
 Starting Oracle Net Listener.
 Starting Oracle Database 11g Express Edition instance.

 Database init...

 /start.sh: running /etc/entrypoint-initdb.d/data.sql

 Table created.

 1 row created.

 1 row created.

 1 row created.

 1 row created.

 End init.
 Oracle started successfully!

發現所 insert 的資料都是亂碼


How-To
這是因為編碼所導致的問題,在啟動指令增加一個參數
-e NLS_LANG="TRADITIONAL CHINESE_TAIWAN.AL32UTF8" 即可解決亂碼問題
docker run -d --shm-size=1g -p 8080:8080 -p 1521:1521 \
-e NLS_LANG="TRADITIONAL CHINESE_TAIWAN.AL32UTF8" \
-v /Users/guojunyou/Documents/docker/local-initdb:/etc/entrypoint-initdb.d \
42dda6eba3ea




2020/02/08

[Docker] Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection

Problem
As I tried to pull a docker image, I got the following error message:
F:\git
λ docker pull orangehrm/oracle-xe-11g
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: 
request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)


How-To
Configure proxy and restart docker


Pull again 
F:\git
λ docker pull orangehrm/oracle-xe-11g
Using default tag: latest
latest: Pulling from orangehrm/oracle-xe-11g
cb56c90f0b30: Pull complete
0acc551e5716: Pull complete
8956dcd35143: Pull complete
908242721214: Pull complete
b44ff14dd3bb: Pull complete
81ac3d025953: Pull complete
b555aeaf1117: Pull complete
e1896669ff82: Pull complete
9437119349eb: Pull complete
96e36910991c: Pull complete
2de589c896ac: Pull complete
c5510f7fcb03: Pull complete
c09e52e19f4b: Pull complete
abbfadca26af: Pull complete
c14464a9caeb: Pull complete
4468bbe36672: Pull complete
85cfa88ee1f2: Pull complete
d4831108a661: Pull complete
0821dd9b7524: Pull complete
b19f8225db0a: Pull complete
3001b1e31fbc: Pull complete
585b27c5a8cb: Pull complete
4977c21ef050: Pull complete
acf12f209883: Pull complete
51a0fc043bdd: Pull complete
47759cd1519f: Pull complete
Digest: sha256:b56c95bb59dfef4ee8d373713209105dedb52f09d56c82f94edb29f1fac3b60c
Status: Downloaded newer image for orangehrm/oracle-xe-11g:latest
docker.io/orangehrm/oracle-xe-11g:latest

2020/02/06

[Docker] error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/version:

Problem
When I try to get my docker version, I get the error message as bellows:
F:\git\doodle\cheers2019 (master -> origin)
λ docker version
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:22:37 2019
 OS/Arch:           windows/amd64
 Experimental:      false
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/version: open //./pipe/docker_engine: The system cannot find the file specified.
 In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

How-To
Start up docker


Check again:
F:\git\doodle\cheers2019 (master -> origin)                     
λ docker version                                                
Client: Docker Engine - Community                               
 Version:           19.03.5                                     
 API version:       1.40                                        
 Go version:        go1.12.12                                   
 Git commit:        633a0ea                                     
 Built:             Wed Nov 13 07:22:37 2019                    
 OS/Arch:           windows/amd64                               
 Experimental:      false                                       
                                                                
Server: Docker Engine - Community                               
 Engine:                                                        
  Version:          19.03.5                                     
  API version:      1.40 (minimum version 1.12)                 
  Go version:       go1.12.12                                   
  Git commit:       633a0ea                                     
  Built:            Wed Nov 13 07:29:19 2019                    
  OS/Arch:          linux/amd64                                 
  Experimental:     false                                       
 containerd:                                                    
  Version:          v1.2.10                                     
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339    
 runc:                                                          
  Version:          1.0.0-rc8+dev                               
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657    
 docker-init:                                                   
  Version:          0.18.0                                      
  GitCommit:        fec3683