diff --git a/app.js b/app.js
index 30f9ab1..94fc0d4 100644
--- a/app.js
+++ b/app.js
@@ -299,9 +299,11 @@ function renderContainers(containers) {
containerList.innerHTML = ''; // Clear the current list
containers.forEach((container) => {
- const name = container.Names[0].replace(/^\//, ''); // Remove leading slash from container names
+ const name = container.Names[0].replace(/^\//, ''); // Remove leading slash
const image = container.Image;
const containerId = container.Id;
+ const ipAddress = container.ipAddress || '-'; // Use the IP address field
+
const row = document.createElement('tr');
row.dataset.containerId = containerId; // Store container ID for reference
row.innerHTML = `
@@ -310,37 +312,32 @@ function renderContainers(containers) {
${container.State} |
0 |
0 |
- - |
+ ${ipAddress} |
-
-
-
-
-
+
+
+
+
+
|
- `;
+ `;
containerList.appendChild(row);
// Add event listeners for action buttons
addActionListeners(row, container);
-
- // Add event listener for duplicate button
- const duplicateBtn = row.querySelector('.action-duplicate');
- duplicateBtn.addEventListener('click', () => openDuplicateModal(container));
});
}
-
// Add event listeners to action buttons
function addActionListeners(row, container) {
const startBtn = row.querySelector('.action-start');
diff --git a/server/server.js b/server/server.js
index b9269dd..92b4168 100644
--- a/server/server.js
+++ b/server/server.js
@@ -59,7 +59,19 @@ swarm.on('connection', (peer) => {
case 'listContainers':
console.log('[INFO] Handling \'listContainers\' command');
const containers = await docker.listContainers({ all: true });
- response = { type: 'containers', data: containers };
+
+ // Fetch detailed network info for each container
+ const detailedContainers = await Promise.all(
+ containers.map(async (container) => {
+ const details = await docker.getContainer(container.Id).inspect();
+ const ipAddress = details.NetworkSettings.Networks
+ ? Object.values(details.NetworkSettings.Networks)[0].IPAddress
+ : '-';
+ return { ...container, ipAddress }; // Add IP address to container data
+ })
+ );
+
+ response = { type: 'containers', data: detailedContainers };
break;
case 'inspectContainer':