Why can't Docker find my sql file to import?












1















I have a SQL file I'm trying to import into a local docker instance. I'm running the following command:



docker exec -i 868b7935cc37  ../my.file.sql -u {user} --password={password} {dbName}


I'm getting the following error back when I run it:
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "../my.file.sql": stat ../my.file.sql: no such file or directory": unknown



I'm only one directory away from the file, hence the ../ in the command. I spoke with the person who gave me the file and the username, password and name are all correct. None of the names, passwords, etc. contain any special characters.



I feel like I'm right there. I don't know why I'm getting the no such file or directory error.



Any and all help is appreciated!



docker inspect gives me



[
{
"Id": "868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98",
"Created": "2018-11-15T20:11:44.9362404Z",
"Path": "docker-entrypoint.sh",
"Args": [
"mysqld"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 4819,
"ExitCode": 0,
"Error": "",
"StartedAt": "2018-11-23T23:15:52.5735445Z",
"FinishedAt": "2018-11-21T01:52:31.3103165Z"
},
"Image": "sha256:583a6e3a3c98793a6c8a3b09d291b574da66f7e1fba6ebfebe3e93c88c3b443a",
"ResolvConfPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/hostname",
"HostsPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/hosts",
"LogPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98-json.log",
"Name": "/dmr_mysql_1",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"dmr_local_mysql_data:/var/lib/mysql:rw",
"dmr_local_mysql_data_backups:/backups:rw"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "dmr_default",
"PortBindings": {
"3306/tcp": [
{
"HostIp": "",
"HostPort": "3306"
}
]
},
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": ,
"CapAdd": null,
"CapDrop": null,
"Dns": ,
"DnsOptions": ,
"DnsSearch": ,
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"DeviceCgroupRules": null,
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/asound",
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4-init/diff:/var/lib/docker/overlay2/d6fbcced29e35b61a9bb5a8db9cec8c561fdcba5b52a61c62af886de180aa93a/diff:/var/lib/docker/overlay2/289d826020070599fe59d4171f40bfcfc41de1bbefa29bcc4cfd0bc0ab5ebb3c/diff:/var/lib/docker/overlay2/05572289cc7498d3d29d09d0b9745c0387c56ef06919ef27517c9131a585a895/diff:/var/lib/docker/overlay2/eed1357572b7a67729f776846e8109fa9493e0083d88bb3edeb2c95410bfa2b4/diff:/var/lib/docker/overlay2/8163d89b53f562d5476ffc8ccabdcb6a935ee932b2544f0d42ada9650b67eb46/diff:/var/lib/docker/overlay2/8ea425a1f09814f6e6f3f9d8f887c0829b2151e359425ea985792a75e65acd90/diff:/var/lib/docker/overlay2/ae06aa0cbb069d340970beb76ad8b278ac4b4f97eaceb1f3b36cb4ba15a2128c/diff:/var/lib/docker/overlay2/16350f1b36b1eb496286e5ad4cdea02f9931d33a6869a6105da766e40793d81a/diff:/var/lib/docker/overlay2/305da8336df57edf64806244981141bd6a05b168653a48f97223e7da0a3ac477/diff:/var/lib/docker/overlay2/2265f0da439e923b98007d292dda922f3a90298bb879c07f2f41afa66c971c7b/diff:/var/lib/docker/overlay2/b5e59e46468f95a1d243b6c99b7421b41715f7ad11bda4095901244a6552bbb9/diff:/var/lib/docker/overlay2/76fdb756320d579aed7713e27b4760a5266fcfde5358903d9e4351d9c77a4b9d/diff:/var/lib/docker/overlay2/58952f226dee428fecc6cf23f45e39b4084f10c6214f3ded03ebd87a250318bd/diff:/var/lib/docker/overlay2/7f03ca1e222e9ee48d8332e6ec830cb0a2a7a27167d2698847d41d3f18c47bd3/diff",
"MergedDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/merged",
"UpperDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/diff",
"WorkDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "dmr_local_mysql_data_backups",
"Source": "/var/lib/docker/volumes/dmr_local_mysql_data_backups/_data",
"Destination": "/backups",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
},
{
"Type": "volume",
"Name": "dmr_local_mysql_data",
"Source": "/var/lib/docker/volumes/dmr_local_mysql_data/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "868b7935cc37",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {},
"33060/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"MYSQL_DATABASE=dmr",
"MYSQL_USER=dmr",
"MYSQL_PASSWORD=dmr",
"MYSQL_ROOT_PASSWORD=dmr",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOSU_VERSION=1.7",
"MYSQL_MAJOR=5.7",
"MYSQL_VERSION=5.7.24-1debian9"
],
"Cmd": [
"mysqld"
],
"ArgsEscaped": true,
"Image": "dmr_mysql",
"Volumes": {
"/backups": {},
"/var/lib/mysql": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "ffc27388c47a8468694fe5412bb06e3dda7a7b083d378fba1ab57eace2b3628e",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "dmr",
"com.docker.compose.service": "mysql",
"com.docker.compose.version": "1.22.0"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "cbccae535b05d954c1592710bb808814a87bcfbee6617fd1fb0a8f44561faec7",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"3306/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "3306"
}
],
"33060/tcp": null
},
"SandboxKey": "/var/run/docker/netns/cbccae535b05",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"dmr_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"868b7935cc37",
"mysql"
],
"NetworkID": "eaf16cd4854d6bcb607ca7598c5337d42b917164404de82f873b9567ab480df7",
"EndpointID": "c98e525c7c4f22e5bfb7b6041a2f94fbf81561f518d2a6b550768ef6c32e57d5",
"Gateway": "172.18.0.1",
"IPAddress": "172.18.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:12:00:02",
"DriverOpts": null
}
}
}
}


]










share|improve this question

























  • User Pablo Munoz requested that you edit your question to include the output of docker inspect 868b7935cc37

    – Caius Jard
    Nov 24 '18 at 6:17













  • daft question maybe but is your file inside the container or is it one directory up from where you are, outside the container, execing from? If it's inside, how do you know what the container thinks the current directory is? If it's outside, it'll need cp'ing in before a program inside the container can see it. See also docs.docker.com/engine/reference/commandline/exec/#examples

    – Caius Jard
    Nov 24 '18 at 6:22













  • Please edit your question, remove the backticks around the output you pasted, highlight the entire output and press the {} button above the edit box. The correct way to post multi line code blocks is to prefix every line with 4 spaces (which is what that button does) not surround it with backticks

    – Caius Jard
    Nov 24 '18 at 6:29
















1















I have a SQL file I'm trying to import into a local docker instance. I'm running the following command:



docker exec -i 868b7935cc37  ../my.file.sql -u {user} --password={password} {dbName}


I'm getting the following error back when I run it:
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "../my.file.sql": stat ../my.file.sql: no such file or directory": unknown



I'm only one directory away from the file, hence the ../ in the command. I spoke with the person who gave me the file and the username, password and name are all correct. None of the names, passwords, etc. contain any special characters.



I feel like I'm right there. I don't know why I'm getting the no such file or directory error.



Any and all help is appreciated!



docker inspect gives me



[
{
"Id": "868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98",
"Created": "2018-11-15T20:11:44.9362404Z",
"Path": "docker-entrypoint.sh",
"Args": [
"mysqld"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 4819,
"ExitCode": 0,
"Error": "",
"StartedAt": "2018-11-23T23:15:52.5735445Z",
"FinishedAt": "2018-11-21T01:52:31.3103165Z"
},
"Image": "sha256:583a6e3a3c98793a6c8a3b09d291b574da66f7e1fba6ebfebe3e93c88c3b443a",
"ResolvConfPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/hostname",
"HostsPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/hosts",
"LogPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98-json.log",
"Name": "/dmr_mysql_1",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"dmr_local_mysql_data:/var/lib/mysql:rw",
"dmr_local_mysql_data_backups:/backups:rw"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "dmr_default",
"PortBindings": {
"3306/tcp": [
{
"HostIp": "",
"HostPort": "3306"
}
]
},
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": ,
"CapAdd": null,
"CapDrop": null,
"Dns": ,
"DnsOptions": ,
"DnsSearch": ,
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"DeviceCgroupRules": null,
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/asound",
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4-init/diff:/var/lib/docker/overlay2/d6fbcced29e35b61a9bb5a8db9cec8c561fdcba5b52a61c62af886de180aa93a/diff:/var/lib/docker/overlay2/289d826020070599fe59d4171f40bfcfc41de1bbefa29bcc4cfd0bc0ab5ebb3c/diff:/var/lib/docker/overlay2/05572289cc7498d3d29d09d0b9745c0387c56ef06919ef27517c9131a585a895/diff:/var/lib/docker/overlay2/eed1357572b7a67729f776846e8109fa9493e0083d88bb3edeb2c95410bfa2b4/diff:/var/lib/docker/overlay2/8163d89b53f562d5476ffc8ccabdcb6a935ee932b2544f0d42ada9650b67eb46/diff:/var/lib/docker/overlay2/8ea425a1f09814f6e6f3f9d8f887c0829b2151e359425ea985792a75e65acd90/diff:/var/lib/docker/overlay2/ae06aa0cbb069d340970beb76ad8b278ac4b4f97eaceb1f3b36cb4ba15a2128c/diff:/var/lib/docker/overlay2/16350f1b36b1eb496286e5ad4cdea02f9931d33a6869a6105da766e40793d81a/diff:/var/lib/docker/overlay2/305da8336df57edf64806244981141bd6a05b168653a48f97223e7da0a3ac477/diff:/var/lib/docker/overlay2/2265f0da439e923b98007d292dda922f3a90298bb879c07f2f41afa66c971c7b/diff:/var/lib/docker/overlay2/b5e59e46468f95a1d243b6c99b7421b41715f7ad11bda4095901244a6552bbb9/diff:/var/lib/docker/overlay2/76fdb756320d579aed7713e27b4760a5266fcfde5358903d9e4351d9c77a4b9d/diff:/var/lib/docker/overlay2/58952f226dee428fecc6cf23f45e39b4084f10c6214f3ded03ebd87a250318bd/diff:/var/lib/docker/overlay2/7f03ca1e222e9ee48d8332e6ec830cb0a2a7a27167d2698847d41d3f18c47bd3/diff",
"MergedDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/merged",
"UpperDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/diff",
"WorkDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "dmr_local_mysql_data_backups",
"Source": "/var/lib/docker/volumes/dmr_local_mysql_data_backups/_data",
"Destination": "/backups",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
},
{
"Type": "volume",
"Name": "dmr_local_mysql_data",
"Source": "/var/lib/docker/volumes/dmr_local_mysql_data/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "868b7935cc37",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {},
"33060/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"MYSQL_DATABASE=dmr",
"MYSQL_USER=dmr",
"MYSQL_PASSWORD=dmr",
"MYSQL_ROOT_PASSWORD=dmr",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOSU_VERSION=1.7",
"MYSQL_MAJOR=5.7",
"MYSQL_VERSION=5.7.24-1debian9"
],
"Cmd": [
"mysqld"
],
"ArgsEscaped": true,
"Image": "dmr_mysql",
"Volumes": {
"/backups": {},
"/var/lib/mysql": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "ffc27388c47a8468694fe5412bb06e3dda7a7b083d378fba1ab57eace2b3628e",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "dmr",
"com.docker.compose.service": "mysql",
"com.docker.compose.version": "1.22.0"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "cbccae535b05d954c1592710bb808814a87bcfbee6617fd1fb0a8f44561faec7",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"3306/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "3306"
}
],
"33060/tcp": null
},
"SandboxKey": "/var/run/docker/netns/cbccae535b05",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"dmr_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"868b7935cc37",
"mysql"
],
"NetworkID": "eaf16cd4854d6bcb607ca7598c5337d42b917164404de82f873b9567ab480df7",
"EndpointID": "c98e525c7c4f22e5bfb7b6041a2f94fbf81561f518d2a6b550768ef6c32e57d5",
"Gateway": "172.18.0.1",
"IPAddress": "172.18.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:12:00:02",
"DriverOpts": null
}
}
}
}


]










share|improve this question

























  • User Pablo Munoz requested that you edit your question to include the output of docker inspect 868b7935cc37

    – Caius Jard
    Nov 24 '18 at 6:17













  • daft question maybe but is your file inside the container or is it one directory up from where you are, outside the container, execing from? If it's inside, how do you know what the container thinks the current directory is? If it's outside, it'll need cp'ing in before a program inside the container can see it. See also docs.docker.com/engine/reference/commandline/exec/#examples

    – Caius Jard
    Nov 24 '18 at 6:22













  • Please edit your question, remove the backticks around the output you pasted, highlight the entire output and press the {} button above the edit box. The correct way to post multi line code blocks is to prefix every line with 4 spaces (which is what that button does) not surround it with backticks

    – Caius Jard
    Nov 24 '18 at 6:29














1












1








1








I have a SQL file I'm trying to import into a local docker instance. I'm running the following command:



docker exec -i 868b7935cc37  ../my.file.sql -u {user} --password={password} {dbName}


I'm getting the following error back when I run it:
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "../my.file.sql": stat ../my.file.sql: no such file or directory": unknown



I'm only one directory away from the file, hence the ../ in the command. I spoke with the person who gave me the file and the username, password and name are all correct. None of the names, passwords, etc. contain any special characters.



I feel like I'm right there. I don't know why I'm getting the no such file or directory error.



Any and all help is appreciated!



docker inspect gives me



[
{
"Id": "868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98",
"Created": "2018-11-15T20:11:44.9362404Z",
"Path": "docker-entrypoint.sh",
"Args": [
"mysqld"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 4819,
"ExitCode": 0,
"Error": "",
"StartedAt": "2018-11-23T23:15:52.5735445Z",
"FinishedAt": "2018-11-21T01:52:31.3103165Z"
},
"Image": "sha256:583a6e3a3c98793a6c8a3b09d291b574da66f7e1fba6ebfebe3e93c88c3b443a",
"ResolvConfPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/hostname",
"HostsPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/hosts",
"LogPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98-json.log",
"Name": "/dmr_mysql_1",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"dmr_local_mysql_data:/var/lib/mysql:rw",
"dmr_local_mysql_data_backups:/backups:rw"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "dmr_default",
"PortBindings": {
"3306/tcp": [
{
"HostIp": "",
"HostPort": "3306"
}
]
},
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": ,
"CapAdd": null,
"CapDrop": null,
"Dns": ,
"DnsOptions": ,
"DnsSearch": ,
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"DeviceCgroupRules": null,
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/asound",
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4-init/diff:/var/lib/docker/overlay2/d6fbcced29e35b61a9bb5a8db9cec8c561fdcba5b52a61c62af886de180aa93a/diff:/var/lib/docker/overlay2/289d826020070599fe59d4171f40bfcfc41de1bbefa29bcc4cfd0bc0ab5ebb3c/diff:/var/lib/docker/overlay2/05572289cc7498d3d29d09d0b9745c0387c56ef06919ef27517c9131a585a895/diff:/var/lib/docker/overlay2/eed1357572b7a67729f776846e8109fa9493e0083d88bb3edeb2c95410bfa2b4/diff:/var/lib/docker/overlay2/8163d89b53f562d5476ffc8ccabdcb6a935ee932b2544f0d42ada9650b67eb46/diff:/var/lib/docker/overlay2/8ea425a1f09814f6e6f3f9d8f887c0829b2151e359425ea985792a75e65acd90/diff:/var/lib/docker/overlay2/ae06aa0cbb069d340970beb76ad8b278ac4b4f97eaceb1f3b36cb4ba15a2128c/diff:/var/lib/docker/overlay2/16350f1b36b1eb496286e5ad4cdea02f9931d33a6869a6105da766e40793d81a/diff:/var/lib/docker/overlay2/305da8336df57edf64806244981141bd6a05b168653a48f97223e7da0a3ac477/diff:/var/lib/docker/overlay2/2265f0da439e923b98007d292dda922f3a90298bb879c07f2f41afa66c971c7b/diff:/var/lib/docker/overlay2/b5e59e46468f95a1d243b6c99b7421b41715f7ad11bda4095901244a6552bbb9/diff:/var/lib/docker/overlay2/76fdb756320d579aed7713e27b4760a5266fcfde5358903d9e4351d9c77a4b9d/diff:/var/lib/docker/overlay2/58952f226dee428fecc6cf23f45e39b4084f10c6214f3ded03ebd87a250318bd/diff:/var/lib/docker/overlay2/7f03ca1e222e9ee48d8332e6ec830cb0a2a7a27167d2698847d41d3f18c47bd3/diff",
"MergedDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/merged",
"UpperDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/diff",
"WorkDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "dmr_local_mysql_data_backups",
"Source": "/var/lib/docker/volumes/dmr_local_mysql_data_backups/_data",
"Destination": "/backups",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
},
{
"Type": "volume",
"Name": "dmr_local_mysql_data",
"Source": "/var/lib/docker/volumes/dmr_local_mysql_data/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "868b7935cc37",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {},
"33060/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"MYSQL_DATABASE=dmr",
"MYSQL_USER=dmr",
"MYSQL_PASSWORD=dmr",
"MYSQL_ROOT_PASSWORD=dmr",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOSU_VERSION=1.7",
"MYSQL_MAJOR=5.7",
"MYSQL_VERSION=5.7.24-1debian9"
],
"Cmd": [
"mysqld"
],
"ArgsEscaped": true,
"Image": "dmr_mysql",
"Volumes": {
"/backups": {},
"/var/lib/mysql": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "ffc27388c47a8468694fe5412bb06e3dda7a7b083d378fba1ab57eace2b3628e",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "dmr",
"com.docker.compose.service": "mysql",
"com.docker.compose.version": "1.22.0"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "cbccae535b05d954c1592710bb808814a87bcfbee6617fd1fb0a8f44561faec7",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"3306/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "3306"
}
],
"33060/tcp": null
},
"SandboxKey": "/var/run/docker/netns/cbccae535b05",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"dmr_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"868b7935cc37",
"mysql"
],
"NetworkID": "eaf16cd4854d6bcb607ca7598c5337d42b917164404de82f873b9567ab480df7",
"EndpointID": "c98e525c7c4f22e5bfb7b6041a2f94fbf81561f518d2a6b550768ef6c32e57d5",
"Gateway": "172.18.0.1",
"IPAddress": "172.18.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:12:00:02",
"DriverOpts": null
}
}
}
}


]










share|improve this question
















I have a SQL file I'm trying to import into a local docker instance. I'm running the following command:



docker exec -i 868b7935cc37  ../my.file.sql -u {user} --password={password} {dbName}


I'm getting the following error back when I run it:
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "../my.file.sql": stat ../my.file.sql: no such file or directory": unknown



I'm only one directory away from the file, hence the ../ in the command. I spoke with the person who gave me the file and the username, password and name are all correct. None of the names, passwords, etc. contain any special characters.



I feel like I'm right there. I don't know why I'm getting the no such file or directory error.



Any and all help is appreciated!



docker inspect gives me



[
{
"Id": "868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98",
"Created": "2018-11-15T20:11:44.9362404Z",
"Path": "docker-entrypoint.sh",
"Args": [
"mysqld"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 4819,
"ExitCode": 0,
"Error": "",
"StartedAt": "2018-11-23T23:15:52.5735445Z",
"FinishedAt": "2018-11-21T01:52:31.3103165Z"
},
"Image": "sha256:583a6e3a3c98793a6c8a3b09d291b574da66f7e1fba6ebfebe3e93c88c3b443a",
"ResolvConfPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/hostname",
"HostsPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/hosts",
"LogPath": "/var/lib/docker/containers/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98/868b7935cc371a0eef47e84a7ffbddb99b03cfc93e735af31e5b5754680c1f98-json.log",
"Name": "/dmr_mysql_1",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"dmr_local_mysql_data:/var/lib/mysql:rw",
"dmr_local_mysql_data_backups:/backups:rw"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "dmr_default",
"PortBindings": {
"3306/tcp": [
{
"HostIp": "",
"HostPort": "3306"
}
]
},
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": ,
"CapAdd": null,
"CapDrop": null,
"Dns": ,
"DnsOptions": ,
"DnsSearch": ,
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"DeviceCgroupRules": null,
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/asound",
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4-init/diff:/var/lib/docker/overlay2/d6fbcced29e35b61a9bb5a8db9cec8c561fdcba5b52a61c62af886de180aa93a/diff:/var/lib/docker/overlay2/289d826020070599fe59d4171f40bfcfc41de1bbefa29bcc4cfd0bc0ab5ebb3c/diff:/var/lib/docker/overlay2/05572289cc7498d3d29d09d0b9745c0387c56ef06919ef27517c9131a585a895/diff:/var/lib/docker/overlay2/eed1357572b7a67729f776846e8109fa9493e0083d88bb3edeb2c95410bfa2b4/diff:/var/lib/docker/overlay2/8163d89b53f562d5476ffc8ccabdcb6a935ee932b2544f0d42ada9650b67eb46/diff:/var/lib/docker/overlay2/8ea425a1f09814f6e6f3f9d8f887c0829b2151e359425ea985792a75e65acd90/diff:/var/lib/docker/overlay2/ae06aa0cbb069d340970beb76ad8b278ac4b4f97eaceb1f3b36cb4ba15a2128c/diff:/var/lib/docker/overlay2/16350f1b36b1eb496286e5ad4cdea02f9931d33a6869a6105da766e40793d81a/diff:/var/lib/docker/overlay2/305da8336df57edf64806244981141bd6a05b168653a48f97223e7da0a3ac477/diff:/var/lib/docker/overlay2/2265f0da439e923b98007d292dda922f3a90298bb879c07f2f41afa66c971c7b/diff:/var/lib/docker/overlay2/b5e59e46468f95a1d243b6c99b7421b41715f7ad11bda4095901244a6552bbb9/diff:/var/lib/docker/overlay2/76fdb756320d579aed7713e27b4760a5266fcfde5358903d9e4351d9c77a4b9d/diff:/var/lib/docker/overlay2/58952f226dee428fecc6cf23f45e39b4084f10c6214f3ded03ebd87a250318bd/diff:/var/lib/docker/overlay2/7f03ca1e222e9ee48d8332e6ec830cb0a2a7a27167d2698847d41d3f18c47bd3/diff",
"MergedDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/merged",
"UpperDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/diff",
"WorkDir": "/var/lib/docker/overlay2/830398a5558d1451a520a7219971cfb6f869cfc7aa149373eab77287c2924ee4/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "dmr_local_mysql_data_backups",
"Source": "/var/lib/docker/volumes/dmr_local_mysql_data_backups/_data",
"Destination": "/backups",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
},
{
"Type": "volume",
"Name": "dmr_local_mysql_data",
"Source": "/var/lib/docker/volumes/dmr_local_mysql_data/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "868b7935cc37",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {},
"33060/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"MYSQL_DATABASE=dmr",
"MYSQL_USER=dmr",
"MYSQL_PASSWORD=dmr",
"MYSQL_ROOT_PASSWORD=dmr",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOSU_VERSION=1.7",
"MYSQL_MAJOR=5.7",
"MYSQL_VERSION=5.7.24-1debian9"
],
"Cmd": [
"mysqld"
],
"ArgsEscaped": true,
"Image": "dmr_mysql",
"Volumes": {
"/backups": {},
"/var/lib/mysql": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "ffc27388c47a8468694fe5412bb06e3dda7a7b083d378fba1ab57eace2b3628e",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "dmr",
"com.docker.compose.service": "mysql",
"com.docker.compose.version": "1.22.0"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "cbccae535b05d954c1592710bb808814a87bcfbee6617fd1fb0a8f44561faec7",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"3306/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "3306"
}
],
"33060/tcp": null
},
"SandboxKey": "/var/run/docker/netns/cbccae535b05",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"dmr_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"868b7935cc37",
"mysql"
],
"NetworkID": "eaf16cd4854d6bcb607ca7598c5337d42b917164404de82f873b9567ab480df7",
"EndpointID": "c98e525c7c4f22e5bfb7b6041a2f94fbf81561f518d2a6b550768ef6c32e57d5",
"Gateway": "172.18.0.1",
"IPAddress": "172.18.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:12:00:02",
"DriverOpts": null
}
}
}
}


]







sql docker






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 5 '18 at 18:01







Lz430

















asked Nov 24 '18 at 6:00









Lz430Lz430

727




727













  • User Pablo Munoz requested that you edit your question to include the output of docker inspect 868b7935cc37

    – Caius Jard
    Nov 24 '18 at 6:17













  • daft question maybe but is your file inside the container or is it one directory up from where you are, outside the container, execing from? If it's inside, how do you know what the container thinks the current directory is? If it's outside, it'll need cp'ing in before a program inside the container can see it. See also docs.docker.com/engine/reference/commandline/exec/#examples

    – Caius Jard
    Nov 24 '18 at 6:22













  • Please edit your question, remove the backticks around the output you pasted, highlight the entire output and press the {} button above the edit box. The correct way to post multi line code blocks is to prefix every line with 4 spaces (which is what that button does) not surround it with backticks

    – Caius Jard
    Nov 24 '18 at 6:29



















  • User Pablo Munoz requested that you edit your question to include the output of docker inspect 868b7935cc37

    – Caius Jard
    Nov 24 '18 at 6:17













  • daft question maybe but is your file inside the container or is it one directory up from where you are, outside the container, execing from? If it's inside, how do you know what the container thinks the current directory is? If it's outside, it'll need cp'ing in before a program inside the container can see it. See also docs.docker.com/engine/reference/commandline/exec/#examples

    – Caius Jard
    Nov 24 '18 at 6:22













  • Please edit your question, remove the backticks around the output you pasted, highlight the entire output and press the {} button above the edit box. The correct way to post multi line code blocks is to prefix every line with 4 spaces (which is what that button does) not surround it with backticks

    – Caius Jard
    Nov 24 '18 at 6:29

















User Pablo Munoz requested that you edit your question to include the output of docker inspect 868b7935cc37

– Caius Jard
Nov 24 '18 at 6:17







User Pablo Munoz requested that you edit your question to include the output of docker inspect 868b7935cc37

– Caius Jard
Nov 24 '18 at 6:17















daft question maybe but is your file inside the container or is it one directory up from where you are, outside the container, execing from? If it's inside, how do you know what the container thinks the current directory is? If it's outside, it'll need cp'ing in before a program inside the container can see it. See also docs.docker.com/engine/reference/commandline/exec/#examples

– Caius Jard
Nov 24 '18 at 6:22







daft question maybe but is your file inside the container or is it one directory up from where you are, outside the container, execing from? If it's inside, how do you know what the container thinks the current directory is? If it's outside, it'll need cp'ing in before a program inside the container can see it. See also docs.docker.com/engine/reference/commandline/exec/#examples

– Caius Jard
Nov 24 '18 at 6:22















Please edit your question, remove the backticks around the output you pasted, highlight the entire output and press the {} button above the edit box. The correct way to post multi line code blocks is to prefix every line with 4 spaces (which is what that button does) not surround it with backticks

– Caius Jard
Nov 24 '18 at 6:29





Please edit your question, remove the backticks around the output you pasted, highlight the entire output and press the {} button above the edit box. The correct way to post multi line code blocks is to prefix every line with 4 spaces (which is what that button does) not surround it with backticks

– Caius Jard
Nov 24 '18 at 6:29












2 Answers
2






active

oldest

votes


















1














I believe the problem is a misunderstanding of how docker exec works. If you think of your container as a remote machine, and docker exec as a command you run on your local machine that will cause the remote machine to execute some command installed on the remote machine, it may become more clear



Right now it looks like you have a file on your local machine (outside the container) and you're passing it as the command you wish the remote machine(inside the container) to run, but the file is on your local machine, not the remote so even if it could be processed (docker help page says it must be an executable file- is an sql file executable in this context?) the file isn't on the machine that is going to process it.



Calling docker exec and passing a file reference of a file outside the container, doesn't cause the local file to be sent into the container and executed inside



As such, I think you'll have to do something more like



docker cp ../myfile.sql DOCKERCONTAINERNAME:/root/myfile.sql


To copy the file into the container and then something like:



docker exec DOCKERCONTAINERNAME mysqlimporttool -u mysqluser -p pass /root/myfile.sql


To have docker launch the in-container import tool for you and pass the arguments you specified. That tool will start up inside the container, and process the file you copied into the container in the first step






share|improve this answer


























  • So the first command works and I can run it with no errors. The 2nd command you gave me is throwing the following error: OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "mysqlimporttool": executable file not found in $PATH": unknown

    – Lz430
    Nov 24 '18 at 6:55













  • I've no idea what the name of the executable that will process your file is. You should adjust the second command to be relevant to your setup

    – Caius Jard
    Nov 24 '18 at 7:08



















0














You don't need docker exec to interact with servers running in containers. Just use the ordinary client programs you'd normally use to talk to them.



For instance, if you launched the database container, publishing the normal MySQL port, as as



docker run -p3306:3306 ... mysql


then you could run your script by installing the mysql command-line client, and then running



mysql -h 127.0.0.1 ../my.file.sql -u {user} --password={password} {dbName}


If you've configured your Docker to require root permission to access it (a very reasonable setup) then this has the additional advantage of not requiring sudo just to run it.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455586%2fwhy-cant-docker-find-my-sql-file-to-import%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    I believe the problem is a misunderstanding of how docker exec works. If you think of your container as a remote machine, and docker exec as a command you run on your local machine that will cause the remote machine to execute some command installed on the remote machine, it may become more clear



    Right now it looks like you have a file on your local machine (outside the container) and you're passing it as the command you wish the remote machine(inside the container) to run, but the file is on your local machine, not the remote so even if it could be processed (docker help page says it must be an executable file- is an sql file executable in this context?) the file isn't on the machine that is going to process it.



    Calling docker exec and passing a file reference of a file outside the container, doesn't cause the local file to be sent into the container and executed inside



    As such, I think you'll have to do something more like



    docker cp ../myfile.sql DOCKERCONTAINERNAME:/root/myfile.sql


    To copy the file into the container and then something like:



    docker exec DOCKERCONTAINERNAME mysqlimporttool -u mysqluser -p pass /root/myfile.sql


    To have docker launch the in-container import tool for you and pass the arguments you specified. That tool will start up inside the container, and process the file you copied into the container in the first step






    share|improve this answer


























    • So the first command works and I can run it with no errors. The 2nd command you gave me is throwing the following error: OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "mysqlimporttool": executable file not found in $PATH": unknown

      – Lz430
      Nov 24 '18 at 6:55













    • I've no idea what the name of the executable that will process your file is. You should adjust the second command to be relevant to your setup

      – Caius Jard
      Nov 24 '18 at 7:08
















    1














    I believe the problem is a misunderstanding of how docker exec works. If you think of your container as a remote machine, and docker exec as a command you run on your local machine that will cause the remote machine to execute some command installed on the remote machine, it may become more clear



    Right now it looks like you have a file on your local machine (outside the container) and you're passing it as the command you wish the remote machine(inside the container) to run, but the file is on your local machine, not the remote so even if it could be processed (docker help page says it must be an executable file- is an sql file executable in this context?) the file isn't on the machine that is going to process it.



    Calling docker exec and passing a file reference of a file outside the container, doesn't cause the local file to be sent into the container and executed inside



    As such, I think you'll have to do something more like



    docker cp ../myfile.sql DOCKERCONTAINERNAME:/root/myfile.sql


    To copy the file into the container and then something like:



    docker exec DOCKERCONTAINERNAME mysqlimporttool -u mysqluser -p pass /root/myfile.sql


    To have docker launch the in-container import tool for you and pass the arguments you specified. That tool will start up inside the container, and process the file you copied into the container in the first step






    share|improve this answer


























    • So the first command works and I can run it with no errors. The 2nd command you gave me is throwing the following error: OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "mysqlimporttool": executable file not found in $PATH": unknown

      – Lz430
      Nov 24 '18 at 6:55













    • I've no idea what the name of the executable that will process your file is. You should adjust the second command to be relevant to your setup

      – Caius Jard
      Nov 24 '18 at 7:08














    1












    1








    1







    I believe the problem is a misunderstanding of how docker exec works. If you think of your container as a remote machine, and docker exec as a command you run on your local machine that will cause the remote machine to execute some command installed on the remote machine, it may become more clear



    Right now it looks like you have a file on your local machine (outside the container) and you're passing it as the command you wish the remote machine(inside the container) to run, but the file is on your local machine, not the remote so even if it could be processed (docker help page says it must be an executable file- is an sql file executable in this context?) the file isn't on the machine that is going to process it.



    Calling docker exec and passing a file reference of a file outside the container, doesn't cause the local file to be sent into the container and executed inside



    As such, I think you'll have to do something more like



    docker cp ../myfile.sql DOCKERCONTAINERNAME:/root/myfile.sql


    To copy the file into the container and then something like:



    docker exec DOCKERCONTAINERNAME mysqlimporttool -u mysqluser -p pass /root/myfile.sql


    To have docker launch the in-container import tool for you and pass the arguments you specified. That tool will start up inside the container, and process the file you copied into the container in the first step






    share|improve this answer















    I believe the problem is a misunderstanding of how docker exec works. If you think of your container as a remote machine, and docker exec as a command you run on your local machine that will cause the remote machine to execute some command installed on the remote machine, it may become more clear



    Right now it looks like you have a file on your local machine (outside the container) and you're passing it as the command you wish the remote machine(inside the container) to run, but the file is on your local machine, not the remote so even if it could be processed (docker help page says it must be an executable file- is an sql file executable in this context?) the file isn't on the machine that is going to process it.



    Calling docker exec and passing a file reference of a file outside the container, doesn't cause the local file to be sent into the container and executed inside



    As such, I think you'll have to do something more like



    docker cp ../myfile.sql DOCKERCONTAINERNAME:/root/myfile.sql


    To copy the file into the container and then something like:



    docker exec DOCKERCONTAINERNAME mysqlimporttool -u mysqluser -p pass /root/myfile.sql


    To have docker launch the in-container import tool for you and pass the arguments you specified. That tool will start up inside the container, and process the file you copied into the container in the first step







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 24 '18 at 7:07

























    answered Nov 24 '18 at 6:40









    Caius JardCaius Jard

    11.8k21239




    11.8k21239













    • So the first command works and I can run it with no errors. The 2nd command you gave me is throwing the following error: OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "mysqlimporttool": executable file not found in $PATH": unknown

      – Lz430
      Nov 24 '18 at 6:55













    • I've no idea what the name of the executable that will process your file is. You should adjust the second command to be relevant to your setup

      – Caius Jard
      Nov 24 '18 at 7:08



















    • So the first command works and I can run it with no errors. The 2nd command you gave me is throwing the following error: OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "mysqlimporttool": executable file not found in $PATH": unknown

      – Lz430
      Nov 24 '18 at 6:55













    • I've no idea what the name of the executable that will process your file is. You should adjust the second command to be relevant to your setup

      – Caius Jard
      Nov 24 '18 at 7:08

















    So the first command works and I can run it with no errors. The 2nd command you gave me is throwing the following error: OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "mysqlimporttool": executable file not found in $PATH": unknown

    – Lz430
    Nov 24 '18 at 6:55







    So the first command works and I can run it with no errors. The 2nd command you gave me is throwing the following error: OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: "mysqlimporttool": executable file not found in $PATH": unknown

    – Lz430
    Nov 24 '18 at 6:55















    I've no idea what the name of the executable that will process your file is. You should adjust the second command to be relevant to your setup

    – Caius Jard
    Nov 24 '18 at 7:08





    I've no idea what the name of the executable that will process your file is. You should adjust the second command to be relevant to your setup

    – Caius Jard
    Nov 24 '18 at 7:08













    0














    You don't need docker exec to interact with servers running in containers. Just use the ordinary client programs you'd normally use to talk to them.



    For instance, if you launched the database container, publishing the normal MySQL port, as as



    docker run -p3306:3306 ... mysql


    then you could run your script by installing the mysql command-line client, and then running



    mysql -h 127.0.0.1 ../my.file.sql -u {user} --password={password} {dbName}


    If you've configured your Docker to require root permission to access it (a very reasonable setup) then this has the additional advantage of not requiring sudo just to run it.






    share|improve this answer




























      0














      You don't need docker exec to interact with servers running in containers. Just use the ordinary client programs you'd normally use to talk to them.



      For instance, if you launched the database container, publishing the normal MySQL port, as as



      docker run -p3306:3306 ... mysql


      then you could run your script by installing the mysql command-line client, and then running



      mysql -h 127.0.0.1 ../my.file.sql -u {user} --password={password} {dbName}


      If you've configured your Docker to require root permission to access it (a very reasonable setup) then this has the additional advantage of not requiring sudo just to run it.






      share|improve this answer


























        0












        0








        0







        You don't need docker exec to interact with servers running in containers. Just use the ordinary client programs you'd normally use to talk to them.



        For instance, if you launched the database container, publishing the normal MySQL port, as as



        docker run -p3306:3306 ... mysql


        then you could run your script by installing the mysql command-line client, and then running



        mysql -h 127.0.0.1 ../my.file.sql -u {user} --password={password} {dbName}


        If you've configured your Docker to require root permission to access it (a very reasonable setup) then this has the additional advantage of not requiring sudo just to run it.






        share|improve this answer













        You don't need docker exec to interact with servers running in containers. Just use the ordinary client programs you'd normally use to talk to them.



        For instance, if you launched the database container, publishing the normal MySQL port, as as



        docker run -p3306:3306 ... mysql


        then you could run your script by installing the mysql command-line client, and then running



        mysql -h 127.0.0.1 ../my.file.sql -u {user} --password={password} {dbName}


        If you've configured your Docker to require root permission to access it (a very reasonable setup) then this has the additional advantage of not requiring sudo just to run it.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 '18 at 11:44









        David MazeDavid Maze

        13.6k31327




        13.6k31327






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455586%2fwhy-cant-docker-find-my-sql-file-to-import%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Futebolista

            Feedback on college project

            Albești (Vaslui)