mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-23 05:19:37 +02:00
Added remote docker host
This commit is contained in:
parent
afc0f16470
commit
231dbc4577
4 changed files with 32 additions and 7 deletions
|
@ -65,16 +65,23 @@ exports.getApps = asyncWrapper(async (req, res, next) => {
|
|||
if (useDockerApi && useDockerApi.value == 1) {
|
||||
let containers = null;
|
||||
|
||||
const host = await Config.findOne({
|
||||
where: { key: 'dockerHost' }
|
||||
});
|
||||
|
||||
try {
|
||||
let { data } = await axios.get(
|
||||
'http://localhost/containers/json?{"status":["running"]}',
|
||||
if(host.value.includes('localhost')) {
|
||||
let { data } = await axios.get(`http://${host.value}/containers/json?{"status":["running"]}`,
|
||||
{
|
||||
socketPath: '/var/run/docker.sock',
|
||||
}
|
||||
);
|
||||
containers = data;
|
||||
socketPath: '/var/run/docker.sock'
|
||||
});
|
||||
containers = data;
|
||||
} else {
|
||||
let { data } = await axios.get(`http://${host.value}/containers/json?{"status":["running"]}`);
|
||||
containers = data;
|
||||
}
|
||||
} catch {
|
||||
logger.log("Can't connect to the docker socket", 'ERROR');
|
||||
logger.log(`Can't connect to the docker api on ${host.value}`, 'ERROR');
|
||||
}
|
||||
|
||||
if (containers) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue