Unhandled rejection Error: HTTP code is 404
I'm trying to notify my slack channel for every docker event. But couldn't succeed yet. Got following error:
Unhandled rejection Error: HTTP code is 404 which indicates error: no such container - [object Object]
How can I solve this issue? Thanks in advance.
Hi @fullyfaltu I'm getting the same error please let me know if you know how to resolve this error or if you got any answer about this error from @int128.
Thanks in adavance
Hi,
This is because dockerode stream other event types than container (like network or volume)
Examples :
{ Type: 'volume',
Action: 'mount',
Actor:
{ ID: 'mysql_data',
Attributes:
{ container: 'd2169583beae6b4916626422a5907f05c7e74d718191b96c1f768181bf47f511',
destination: '/var/lib/mysql',
driver: 'local',
propagation: '',
'read/write': 'true' } },
time: 1493816904,
timeNano: '1493816904332490264' }
or
{ Type: 'network',
Action: 'connect',
Actor:
{ ID: 'fbf740ad0300aa6a60c8a381c848c80d6721f343c9d2a6738e2a1f24d73725d4',
Attributes:
{ container: 'd2169583beae6b4916626422a5907f05c7e74d718191b96c1f768181bf47f511',
name: 'mysql_network',
type: 'bridge' } },
time: 1493816904,
timeNano: '1493816904304038536' }
You have to filter those events at line 15 https://github.com/int128/slack-docker/blob/master/app.js#L15
if ((!event.Type || event.Type == 'container') && this._imageRegExp.test(event.from)) {