mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-13 10:04:42 +08:00
feat: The container-compose module is adapted for Docker Compose. (#9536)
This commit is contained in:
parent
1aec5e443d
commit
ff5cdb9a02
3 changed files with 8 additions and 15 deletions
|
@ -5,7 +5,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"path"
|
"path"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -174,7 +173,7 @@ func (u *ContainerService) TestCompose(req dto.ComposeCreate) (bool, error) {
|
||||||
if err := newComposeEnv(req.Path, req.Env); err != nil {
|
if err := newComposeEnv(req.Path, req.Env); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
cmd := exec.Command("docker", "compose", "-f", req.Path, "config")
|
cmd := getComposeCmd(req.Path, "config")
|
||||||
stdout, err := cmd.CombinedOutput()
|
stdout, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, errors.New(string(stdout))
|
return false, errors.New(string(stdout))
|
||||||
|
@ -201,7 +200,7 @@ func (u *ContainerService) CreateCompose(req dto.ComposeCreate) error {
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
taskItem.AddSubTask(i18n.GetMsgByKey("ComposeCreate"), func(t *task.Task) error {
|
taskItem.AddSubTask(i18n.GetMsgByKey("ComposeCreate"), func(t *task.Task) error {
|
||||||
cmd := exec.Command("docker", "compose", "-f", req.Path, "up", "-d")
|
cmd := getComposeCmd(req.Path, "up")
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
taskItem.Log(i18n.GetWithName("ComposeCreateRes", string(out)))
|
taskItem.Log(i18n.GetWithName("ComposeCreateRes", string(out)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<div v-loading="loading">
|
<div v-loading="loading">
|
||||||
<div class="app-content" style="margin-top: 20px">
|
<div class="app-status card-interval">
|
||||||
<el-card class="app-card">
|
<el-card>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20" class="items-center">
|
||||||
<div>
|
<div class="ml-5">
|
||||||
<el-tag effect="dark" type="success">{{ composeName }}</el-tag>
|
<el-tag effect="dark" type="success">{{ composeName }}</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="createdBy === '1Panel'" style="margin-left: 50px">
|
<div v-if="createdBy === '1Panel'" class="ml-10">
|
||||||
<el-button link type="primary" @click="onComposeOperate('up')">
|
<el-button link type="primary" @click="onComposeOperate('up')">
|
||||||
{{ $t('commons.operate.start') }}
|
{{ $t('commons.operate.start') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
<LayoutContent
|
<LayoutContent
|
||||||
style="margin-top: 30px"
|
style="margin-top: 10px"
|
||||||
back-name="Compose"
|
back-name="Compose"
|
||||||
:title="$t('container.containerList')"
|
:title="$t('container.containerList')"
|
||||||
:reload="true"
|
:reload="true"
|
||||||
|
@ -335,11 +335,6 @@ defineExpose({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.app-card {
|
|
||||||
font-size: 14px;
|
|
||||||
height: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-content {
|
.app-content {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
<div v-show="isOnDetail">
|
<div v-show="isOnDetail">
|
||||||
<ComposeDetail ref="composeDetailRef" />
|
<ComposeDetail ref="composeDetailRef" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<docker-status
|
<docker-status
|
||||||
v-model:isActive="isActive"
|
v-model:isActive="isActive"
|
||||||
v-model:isExist="isExist"
|
v-model:isExist="isExist"
|
||||||
|
|
Loading…
Add table
Reference in a new issue