Use json.Encoder for container.writeHostConfig
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
parent
23a0fe9627
commit
cf1a6c08fa
1 changed files with 7 additions and 7 deletions
|
@ -5,7 +5,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -165,17 +164,18 @@ func (container *Container) readHostConfig() error {
|
|||
}
|
||||
|
||||
func (container *Container) writeHostConfig() error {
|
||||
data, err := json.Marshal(container.hostConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pth, err := container.hostConfigPath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(pth, data, 0666)
|
||||
f, err := os.Create(pth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
return json.NewEncoder(f).Encode(&container.hostConfig)
|
||||
}
|
||||
|
||||
func (container *Container) logEvent(action string) {
|
||||
|
|
Loading…
Reference in a new issue