Remove unused code (docker ps)
This commit is contained in:
parent
d0b59cb411
commit
75d2a81e2b
10
app.go
10
app.go
@ -49,16 +49,6 @@ func NewApp(cfg *config.Config) App {
|
||||
c.JSON(http.StatusOK, gin.H{"version": 0.1})
|
||||
})
|
||||
|
||||
router.GET("/api/ps", func(c *gin.Context) {
|
||||
containers, err := docker.Ps()
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, containers)
|
||||
})
|
||||
|
||||
router.GET("/api/run", func(c *gin.Context) {
|
||||
myVolume, err := docker.CreateVolumeDir("/data", false)
|
||||
if err != nil {
|
||||
|
@ -16,20 +16,6 @@ func newCli() (*client.Client, error) {
|
||||
return client.NewClientWithOpts(client.FromEnv)
|
||||
}
|
||||
|
||||
func Ps() ([]types.Container, error) {
|
||||
cli, err := newCli()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return containers, nil
|
||||
}
|
||||
|
||||
func Run(image string, cmd []string, mounts []mount.Mount) (string, error) {
|
||||
cli, err := newCli()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user