mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 11:10:11 +08:00
refactor: separate createSession to sessionManager
This commit is contained in:
1 parent
7843020524
commit
11bc793b12
7 files changed
+68
-49
No files matched your search
@@ -25,17 +25,19 @@ const containerOptions = {
|
||||
|
||||
// const network = engine.getNetwork(config.dockerNetwork)
|
||||
|
||||
export async function createContainer(name) {
|
||||
const container = await engine.createContainer({
|
||||
export function createContainer(name) {
|
||||
return engine.createContainer({
|
||||
...containerOptions,
|
||||
name,
|
||||
})
|
||||
return container
|
||||
}
|
||||
|
||||
export async function getAndStartContainer(id) {
|
||||
console.log(`Getting container: ${id}`)
|
||||
const container = engine.getContainer(id)
|
||||
if (!container) {
|
||||
throw new Error(`Container ${id} not found`)
|
||||
}
|
||||
if (!(await container.inspect()).State.Running) {
|
||||
await container.start()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user