Closed Oyabi closed 8 years ago
Any clues in the logs?
$ docker-compose logs varnish
Hi, here is the result:
$ docker-compose logs varnish
Attaching to webstack_varnish_1
webstack_varnish_1 exited with code 0
OK, so it's exiting immediately, but not erroring out.
Could you run a docker inspect
on both the container you started with docker run
and the one started by docker-compose up
, and diff the output?
Ok, so here the output with my script (docker run ...
):
[
{
"Id": "f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04",
"Created": "2015-12-21T16:20:51.137619434Z",
"Path": "/bin/bash",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 18189,
"ExitCode": 0,
"Error": "",
"StartedAt": "2015-12-21T16:20:51.939341565Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "46f9d7deaa29c35632854e24a67e0e754c7f8cc5dffc0c202763eb18869e2bbe",
"ResolvConfPath": "/home/docker/containers/f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04/resolv.conf",
"HostnamePath": "/home/docker/containers/f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04/hostname",
"HostsPath": "/home/docker/containers/f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04/hosts",
"LogPath": "/home/docker/containers/f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04/f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04-json.log",
"Name": "/varnish",
"RestartCount": 0,
"Driver": "aufs",
"ExecDriver": "native-0.2",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/home/webstack/varnish/:/etc/varnish"
],
"ContainerIDFile": "",
"LxcConf": [],
"Memory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"KernelMemory": 0,
"CpuShares": 0,
"CpuPeriod": 0,
"CpusetCpus": "",
"CpusetMems": "",
"CpuQuota": 0,
"BlkioWeight": 0,
"OomKillDisable": false,
"MemorySwappiness": -1,
"Privileged": false,
"PortBindings": {
"80/tcp": [
{
"HostIp": "",
"HostPort": "80"
}
]
},
"Links": [
"/nginx:/varnish/nginx"
],
"PublishAllPorts": true,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"VolumesFrom": null,
"Devices": [],
"NetworkMode": "default",
"IpcMode": "",
"PidMode": "",
"UTSMode": "",
"CapAdd": null,
"CapDrop": null,
"GroupAdd": null,
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"SecurityOpt": null,
"ReadonlyRootfs": false,
"Ulimits": null,
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"CgroupParent": "",
"ConsoleSize": [
0,
0
],
"VolumeDriver": ""
},
"GraphDriver": {
"Name": "aufs",
"Data": null
},
"Mounts": [
{
"Source": "/home/webstack/varnish",
"Destination": "/etc/varnish",
"Mode": "",
"RW": true
}
],
"Config": {
"Hostname": "f875823084b0",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": true,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/bash"
],
"Image": "varnish",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {},
"StopSignal": "SIGTERM"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "9d91d08018e4b4a9cd33b8ae9302ab54ec198d94a1951ef2264f4ea7c92d77aa",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "80"
}
]
},
"SandboxKey": "/var/run/docker/netns/9d91d08018e4",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "2189ddd9dc6c569ce2a67c764dd1416671637ea024129e5338003a2189dc68ba",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:04",
"Networks": {
"bridge": {
"EndpointID": "2189ddd9dc6c569ce2a67c764dd1416671637ea024129e5338003a2189dc68ba",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:04"
}
}
}
}
]
And with docker-compose up
:
[
{
"Id": "0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64",
"Created": "2015-12-21T16:43:27.421558599Z",
"Path": "/bin/bash",
"Args": [],
"State": {
"Status": "restarting",
"Running": true,
"Paused": false,
"Restarting": true,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 0,
"Error": "",
"StartedAt": "2015-12-21T16:45:15.728052393Z",
"FinishedAt": "2015-12-21T16:45:15.78957317Z"
},
"Image": "d6c975831a5d773810468c7fbf4015971ce8120ae4c3a432809bedf61a99a473",
"ResolvConfPath": "/home/docker/containers/0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64/resolv.conf",
"HostnamePath": "/home/docker/containers/0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64/hostname",
"HostsPath": "/home/docker/containers/0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64/hosts",
"LogPath": "/home/docker/containers/0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64/0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64-json.log",
"Name": "/webstack_varnish_1",
"RestartCount": 9,
"Driver": "aufs",
"ExecDriver": "native-0.2",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/home/webstack/varnish:/etc/varnish:rw"
],
"ContainerIDFile": "",
"LxcConf": null,
"Memory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"KernelMemory": 0,
"CpuShares": 0,
"CpuPeriod": 0,
"CpusetCpus": "",
"CpusetMems": "",
"CpuQuota": 0,
"BlkioWeight": 0,
"OomKillDisable": false,
"MemorySwappiness": null,
"Privileged": false,
"PortBindings": {
"80/tcp": [
{
"HostIp": "",
"HostPort": "80"
}
]
},
"Links": [
"/webstack_nginx_1:/webstack_varnish_1/nginx",
"/webstack_nginx_1:/webstack_varnish_1/nginx_1",
"/webstack_nginx_1:/webstack_varnish_1/webstack_nginx_1"
],
"PublishAllPorts": false,
"Dns": null,
"DnsOptions": null,
"DnsSearch": null,
"ExtraHosts": null,
"VolumesFrom": [],
"Devices": null,
"NetworkMode": "default",
"IpcMode": "",
"PidMode": "",
"UTSMode": "",
"CapAdd": null,
"CapDrop": null,
"GroupAdd": null,
"RestartPolicy": {
"Name": "always",
"MaximumRetryCount": 0
},
"SecurityOpt": null,
"ReadonlyRootfs": false,
"Ulimits": null,
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"CgroupParent": "",
"ConsoleSize": [
0,
0
],
"VolumeDriver": ""
},
"GraphDriver": {
"Name": "aufs",
"Data": null
},
"Mounts": [
{
"Source": "/home/webstack/varnish",
"Destination": "/etc/varnish",
"Mode": "rw",
"RW": true
}
],
"Config": {
"Hostname": "0864cd3fe6a5",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/bash"
],
"Image": "webstack_varnish",
"Volumes": {
"/etc/varnish": {}
},
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "b26f907379b2f8d703936c30b98097690d22747ef2fdfa3a4ac91fee30a113bb",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "webstack",
"com.docker.compose.service": "varnish",
"com.docker.compose.version": "1.5.2"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "bbfb70fb8e3a4e94dcaeecfd67dcd03856f8f3fc54ae385e5037ab4e22e008e7",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "80"
}
]
},
"SandboxKey": "/var/run/docker/netns/bbfb70fb8e3a",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "5ce3f766805fd601644c809a5661d594fdf11a02c7c6db0fd3e4f2e72dc58c92",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:04",
"Networks": {
"bridge": {
"EndpointID": "5ce3f766805fd601644c809a5661d594fdf11a02c7c6db0fd3e4f2e72dc58c92",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:04"
}
}
}
}
]
The only significant difference I can see is that Tty
is true
for the one you started with docker run
and false
for the one you started with Compose. You could try adding tty: true
to the service config, but I don't know if that'll change anything.
The diff, for reference:
3,4c3,4
< "Id": "f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04",
< "Created": "2015-12-21T16:20:51.137619434Z",
---
> "Id": "0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64",
> "Created": "2015-12-21T16:43:27.421558599Z",
8c8
< "Status": "running",
---
> "Status": "restarting",
11c11
< "Restarting": false,
---
> "Restarting": true,
14c14
< "Pid": 18189,
---
> "Pid": 0,
17,18c17,18
< "StartedAt": "2015-12-21T16:20:51.939341565Z",
< "FinishedAt": "0001-01-01T00:00:00Z"
---
> "StartedAt": "2015-12-21T16:45:15.728052393Z",
> "FinishedAt": "2015-12-21T16:45:15.78957317Z"
20,26c20,26
< "Image": "46f9d7deaa29c35632854e24a67e0e754c7f8cc5dffc0c202763eb18869e2bbe",
< "ResolvConfPath": "/home/docker/containers/f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04/resolv.conf",
< "HostnamePath": "/home/docker/containers/f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04/hostname",
< "HostsPath": "/home/docker/containers/f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04/hosts",
< "LogPath": "/home/docker/containers/f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04/f875823084b08d3db4e16c92bae6a43908ff3f408445c84f3e66b0db93e92f04-json.log",
< "Name": "/varnish",
< "RestartCount": 0,
---
> "Image": "d6c975831a5d773810468c7fbf4015971ce8120ae4c3a432809bedf61a99a473",
> "ResolvConfPath": "/home/docker/containers/0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64/resolv.conf",
> "HostnamePath": "/home/docker/containers/0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64/hostname",
> "HostsPath": "/home/docker/containers/0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64/hosts",
> "LogPath": "/home/docker/containers/0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64/0864cd3fe6a5ed3af21c1b379687bc470c4bb14ad9750c0b1eb79311780dda64-json.log",
> "Name": "/webstack_varnish_1",
> "RestartCount": 9,
35c35
< "/home/webstack/varnish/:/etc/varnish"
---
> "/home/webstack/varnish:/etc/varnish:rw"
38c38
< "LxcConf": [],
---
> "LxcConf": null,
50c50
< "MemorySwappiness": -1,
---
> "MemorySwappiness": null,
61c61,63
< "/nginx:/varnish/nginx"
---
> "/webstack_nginx_1:/webstack_varnish_1/nginx",
> "/webstack_nginx_1:/webstack_varnish_1/nginx_1",
> "/webstack_nginx_1:/webstack_varnish_1/webstack_nginx_1"
63,66c65,68
< "PublishAllPorts": true,
< "Dns": [],
< "DnsOptions": [],
< "DnsSearch": [],
---
> "PublishAllPorts": false,
> "Dns": null,
> "DnsOptions": null,
> "DnsSearch": null,
68,69c70,71
< "VolumesFrom": null,
< "Devices": [],
---
> "VolumesFrom": [],
> "Devices": null,
78c80
< "Name": "no",
---
> "Name": "always",
103c105
< "Mode": "",
---
> "Mode": "rw",
108c110
< "Hostname": "f875823084b0",
---
> "Hostname": "0864cd3fe6a5",
117c119
< "Tty": true,
---
> "Tty": false,
126,127c128,131
< "Image": "varnish",
< "Volumes": null,
---
> "Image": "webstack_varnish",
> "Volumes": {
> "/etc/varnish": {}
> },
131,132c135,142
< "Labels": {},
< "StopSignal": "SIGTERM"
---
> "Labels": {
> "com.docker.compose.config-hash": "b26f907379b2f8d703936c30b98097690d22747ef2fdfa3a4ac91fee30a113bb",
> "com.docker.compose.container-number": "1",
> "com.docker.compose.oneoff": "False",
> "com.docker.compose.project": "webstack",
> "com.docker.compose.service": "varnish",
> "com.docker.compose.version": "1.5.2"
> }
136c146
< "SandboxID": "9d91d08018e4b4a9cd33b8ae9302ab54ec198d94a1951ef2264f4ea7c92d77aa",
---
> "SandboxID": "bbfb70fb8e3a4e94dcaeecfd67dcd03856f8f3fc54ae385e5037ab4e22e008e7",
148c158
< "SandboxKey": "/var/run/docker/netns/9d91d08018e4",
---
> "SandboxKey": "/var/run/docker/netns/bbfb70fb8e3a",
151c161
< "EndpointID": "2189ddd9dc6c569ce2a67c764dd1416671637ea024129e5338003a2189dc68ba",
---
> "EndpointID": "5ce3f766805fd601644c809a5661d594fdf11a02c7c6db0fd3e4f2e72dc58c92",
161c171
< "EndpointID": "2189ddd9dc6c569ce2a67c764dd1416671637ea024129e5338003a2189dc68ba",
---
> "EndpointID": "5ce3f766805fd601644c809a5661d594fdf11a02c7c6db0fd3e4f2e72dc58c92",
Oh it's seem to work:
28751cabba47 webstack_varnish "/bin/bash" About a minute ago Up About a minute 0.0.0.0:80->80/tcp webstack_varnish_1
.
Thank you very much but did you know why it have this behaviour ?
It must be something with the application itself, it exits (or make it backgrounds) if there is no tty present.
Sounds like this is working.
I'm new to docker and try to convert my actual web stack in it. Currently I use this configuration: varnish -> nginx -> php-fpm -> mysql
I have already convert php-fpm and nginx and now tries varnish.
When I run my image with a command, all is fine but when I put it in docker-compose my container restart indefinitely.
Command:
My docker-compose.yml:
I have no result with
docker logs webstack_varnish_1
anddocker ps -a
result show:Here you can see my
Dockerfile
:What I am doing wrong please?
Regards.