色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

docker容器內(nèi)怎么連接外部的mysql

劉姿婷2年前146瀏覽0評論
docker容器內(nèi)怎么連接外部的mysql?

1.用-v掛載主機(jī)數(shù)據(jù)卷到容器內(nèi)

[plain]viewplaincopy

dockerrun-v/path/to/hostdir:/mnt$container

在容器內(nèi)拷貝

cp/mnt/sourcefile/path/to/destfile

2.直接在主機(jī)上拷貝到容器物理存儲(chǔ)系統(tǒng)

A.獲取容器名稱或者id:

[plain]viewplaincopy

$dockerps

B.獲取整個(gè)容器的id

[plain]viewplaincopy

$dockerinspect-f'{{.Id}}'步驟A獲取的名稱或者id

C.在主機(jī)上拷貝文件:

[plain]viewplaincopy

$sudocppath-file-host/var/lib/docker/aufs/mnt/FULL_CONTAINER_ID/PATH-NEW-FILE

或者

$sudocppath-file-host/var/lib/docker/devicemapper/mnt/123abc>/rootfs/root

例子:

[plain]viewplaincopy

$dockerps

CONTAINERIDIMAGECOMMANDCREATEDSTATUSPORTSNAMES

d8e703d7e303solidleon/ssh:latest/usr/sbin/sshd-Dcranky_pare

$dockerinspect-f'{{.Id}}'cranky_pare

or

$dockerinspect-f'{{.Id}}'d8e703d7e303

d8e703d7e3039a6df6d01bd7fb58d1882e592a85059eb16c4b83cf91847f88e5

$sudocpfile.txt/var/lib/docker/aufs/mnt/**d8e703d7e3039a6df6d01bd7fb58d1882e592a85059eb16c4b83cf91847f88e5

3.用輸入輸出符

[plain]viewplaincopy

dockerrun-iubuntu/bin/bash-c'cat>/path/to/container/file'

或者

[plain]viewplaincopy

dockerexec-it