我正在尝试为Oracle 12c实例创建容器以进行测试。我正在使用此处提供的图片:Oracle Image
我按照页面上的说明编写以下docker命令:
docker pull sath89/oracle-12c
docker run -d -p 8080:8080 -p 1521:1521 sath89/oracle-12c
这在运行docker ps时给出了以下输出:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ec8edeef718b sath89/oracle-12c "/entrypoint.sh " 5 minutes ago Up 5 minutes 0.0.0.0:1521->1521/tcp, 0.0.0.0:8080->8080/tcp vigilant_johnson
运行docker时的以下输出记录ec8edeef718b
Database not initialized. Initializing database.
Starting tnslsnr
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/xe/xe.log" for further details.
Configuring Apex console
Database initialized. Please visit http://#containeer:8080/em http://#containeer:8080/apex for extra configuration if needed
Starting web management console
PL/SQL procedure successfully completed.
Starting import from '/docker-entrypoint-initdb.d':
found file /docker-entrypoint-initdb.d//docker-entrypoint-initdb.d/*
[IMPORT] /entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
Import finished
Database ready to use. Enjoy! ;)
我还登录了docker容器,可以使用sqlplus连接到oracle数据库。
问题:
我无法连接到docker公开的任何端口。如果我运行如下命令:curl localhost:8080
我希望得到一个响应但是我收到以下错误:
curl: (56) Recv failure: Connection reset by peer
与其他docker容器类似,我无法从Linux主机中的进程连接到公开端口。
在主机中运行netstat - peanut,我得到以下结果:
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/P rogram name
tcp6 0 0 :::8080 :::* LISTEN 0 13221239 9994/ docker-proxy
tcp6 0 0 :::1521 :::* LISTEN 0 13220123 10006 /docker-proxy
这让我相信docker代理正在侦听该端口。随后我在vm中运行netstat以查看是否有内部进程监听。
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1001 13230948 -
tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 1001 13220287 -
泊坞广告版
Client:
Version: 17.05.0-ce-rc3
API version: 1.29
Go version: go1.7.5
Git commit: 90d35ab
Built: Tue May 2 17:58:25 2017
OS/Arch: linux/amd64
Server:
Version: 17.05.0-ce-rc3
API version: 1.29 (minimum version 1.12)
Go version: go1.7.5
Git commit: 90d35ab
Built: Tue May 2 17:58:25 2017
OS/Arch: linux/amd64
Experimental: false
码头信息
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 1
Server Version: 17.05.0-ce-rc3
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 16
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.8.0-49-generic
Operating System: Ubuntu 16.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 31.42GiB
Name: interfacing-dev0
ID: 2L2W:IHPH:YJWP:VINZ:TOIJ:AIO6:F6ZV:2ZP3:YW4Z:4N3Q:PD5A:ANQD
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false