question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error on startup on a Mac

See original GitHub issue

Expected Behavior

“UI” comes up

Actual Behavior

HTML error page is displayed

Steps to Re-produce the Problem

$ docker-machine env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://...:2376"
export DOCKER_CERT_PATH="/Users/.../.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
$ npm install -g dockly
...
$ dockly
Usage: dockly [OPTIONS]
...
Trace: { Error: (HTTP code 503) unexpected - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
...
			<div id="main">
				<h1>Websites are turned off.</h1>
				<h2>An administrator can turn them on using the Server application.</h2>
			</div>
...
    at /Users/mu/.nodenv/versions/8.2.1/lib/node_modules/dockly/node_modules/docker-modem/lib/modem.js:254:17
    at getCause (/Users/mu/.nodenv/versions/8.2.1/lib/node_modules/dockly/node_modules/docker-modem/lib/modem.js:284:7)
    at Modem.buildPayload (/Users/mu/.nodenv/versions/8.2.1/lib/node_modules/dockly/node_modules/docker-modem/lib/modem.js:253:5)
    at IncomingMessage.<anonymous> (/Users/mu/.nodenv/versions/8.2.1/lib/node_modules/dockly/node_modules/docker-modem/lib/modem.js:229:14)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1045:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  reason: undefined,
  statusCode: 503,
  json: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n\t"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n\n<html xmlns="http://www.w3.org/1999/xhtml" lang="en">\n\t<head>\n\t\t<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n\t\t<title>Server</title>\n\t\t<style type="text/css">\n\t\t* {\t\t\n\t\t\t-webkit-box-sizing: border-box;\n\t\t\t-moz-box-sizing: border-box;\n\t\t\t-box-sizing: border-box;\n\t\t}\n\t\tbody, html {\n\t\t\tbackground-color: #F2F3F4;\n\t\t\tcolor: #333333;\n\t\t\tfont-family: \'Lucida Grande\', \'Lucida Sans Unicode\', Helvetica, Arial, Verdana, sans-serif;\n\t\t\tfont-size: 14px;\n\t\t\theight: 100%;\n\t\t\tline-height: 21px;\n\t\t\tmargin: 0px;\n\t\t\ttext-align: center;\n\t\t\tword-spacing: -1px;\n\t\t}\n\t\t#content {\n\t\t\tpadding: 26px;\n\t\t}\n\t\t#main {\n\t\t\tbackground: #FFFFFF;\n\t\t\tborder: 1px solid #D5D5D6;\n\t\t\tborder-top-color: #E0E1E2;\n\t\t\tborder-bottom-color: #C0C1C2;\n\t\t\tmargin: 0px auto 0px auto;\n\t\t\tpadding: 100px 0px 100px 0px;\n\t\t\twidth: 730px;\n\t\t\t-webkit-box-shadow: 0px 1px 3px rgba(0,0,0,0.1);\n\t\t\t-moz-box-shadow: 0px 1px 3px rgba(0,0,0,0.1);\n\t\t\tbox-shadow: 0px 1px 3px rgba(0,0,0,0.1);\n\t\t\t-webkit-border-radius: 6px;\n\t\t\t-moz-border-radius: 6px;\n\t\t\tborder-radius: 6px;\n\t\t}\n\t\th1, h2 {\n\t\t\tcolor: #BBBBBB;\n\t\t\tfont-family: Helvetica, Arial, Verdana, sans-serif;\n\t\t\tfont-size: 18px;\n\t\t\tfont-weight: normal;\n\t\t\tline-height: 25px;\n\t\t\tmargin: 0px;\n\t\t\ttext-align: center;\n\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div id="content">\n\t\t\t<div id="main">\n\t\t\t\t<h1>Websites are turned off.</h1>\n\t\t\t\t<h2>An administrator can turn them on using the Server application.</h2>\n\t\t\t</div>\n\t\t</div>\n\t</body>\n</html>\n' }
    at exitError (/Users/mu/.nodenv/versions/8.2.1/lib/node_modules/dockly/index.js:68:13)
    at initDockerConnection.then.then.catch (/Users/mu/.nodenv/versions/8.2.1/lib/node_modules/dockly/index.js:21:12)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Context

  • Operating System: macOS high sierra
  • Node.js version: 8.2.1
  • Package version: latest (–version doesn’t work either)
  • Docker version: 17.09.0-ce
  • Is docker installed locally? docker-machine with fusion driver
  • Do you have containers created? yes
  • Does this file exists /var/run/docker.sock ? no (see output of docker-machine env above)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
mutechcommented, Nov 2, 2017

I’m silly, overlooked that the API wants the data and not the path/url to cert files. Here is the code fragment that works for me:

const DOCKER_CERT_PATH = process.env.DOCKER_CERT_PATH || false

let dockerCon

function util (connection) {
  if (typeof connection !== 'object') {
    throw new Error('Error: docker connection string is faulty, please review command line arguments.')
  }

  if (!connection.hasOwnProperty('socketPath') && !connection.hasOwnProperty('host')) {
    // attempt honoring the DOCKER_HOST variable, and fallback to connect using the
    // the docker daemon socket
    if (DOCKER_HOST) {
      const parsedUrl = parseUrl(DOCKER_HOST)
      let parameters = {host: parsedUrl.hostname, port: parsedUrl.port};

      if (DOCKER_CERT_PATH) {
        const base = new url.URL(DOCKER_CERT_PATH.endsWith('/') ? DOCKER_CERT_PATH : DOCKER_CERT_PATH + '/', 'file://');
        ['ca', 'cert', 'key'].forEach(
          function (fileName) {
            const fileUrl = new url.URL(fileName + '.pem', base)
            const data = fs.readFileSync(fileUrl)
            if (data) {
              parameters[fileName] = data
            }
          })
      }
      dockerCon = new DockerLib(parameters)

    } else {
      dockerCon = new DockerLib({socketPath: DOCKER_SOCKET})
    }
  } else {
    dockerCon = new DockerLib(connection)
  }
}
0reactions
lirantalcommented, Nov 3, 2017

@mutech I removed all that connection handling from dockly and offloaded it to the underlying docker library I use (dockerode) so it should already handle all of these environment variables and such.

I released dockly 3.1.0 if you care to upgrade and test (and use 😃 )

Read more comments on GitHub >

github_iconTop Results From Across the Web

If your Mac doesn't start up all the way - Apple Support
If your Mac doesn't start up all the way or needs you to do something during startup, it might stop at one of...
Read more >
How to Troubleshoot Startup Problems With Your Mac - Lifewire
Create a spare user account and use Safe Boot to troubleshoot startup errors. · Use keyboard shortcuts to control the startup process. ·...
Read more >
How to Fix Mac Startup Problems Using Recovery Mode
The first thing you'll need to do is boot into Recovery Mode. Fortunately, that's easy. Turn off your Mac and then restart it,...
Read more >
Mac Won't Boot or Start? How to Fix Issues With a Mac Not ...
1. Check If the Mac Has Power · 2. Run a Power Cycle · 3. Boot Into Safe Mode · 4. Reset SMC...
Read more >
How to Fix No Startup Disk Error on Mac? | Stellar
How do I fix no startup disk error on Mac? · Shut down your Mac, then turn it back on while pressing and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found