Skip to content

Commit

Permalink
Show better network address
Browse files Browse the repository at this point in the history
Shows 127.0.0.1:8080 instead of tcp://0.0.0.0:8080
  • Loading branch information
khornberg committed May 13, 2016
1 parent f01f3aa commit e087392
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function render_container(container) {
var button_action = exited ? "play" : "stop";
var name = container.Names[container.Names.length - 1].substr(1);
var network = containers.Ports === undefined ? container.Ports[container.Ports.length - 1] : false;
var network_display = network ? `${network.Type}://${network.IP}:${network.PublicPort}${network.PrivatePort}` : '';
var network_display = network ? `${getAddress(network)}${network.PrivatePort}` : '';

return `
<li class="table-view-cell media">
Expand All @@ -50,6 +50,15 @@ function render_container(container) {
</li>`;
}

function getIp() {
if (docker.modem.socketPath) { return '127.0.0.1'; }
return docker.modem.host;
}

function getAddress(network) {
return `${getIp()}:${network.PublicPort}`;
}

function controlContainer(e) {
var command = e.srcElement.className.substr(-4);
command = command === 'play' ? 'start' : command;
Expand Down

0 comments on commit e087392

Please sign in to comment.