@@ -77,7 +77,7 @@ func (daemon *Daemon) rmLink(container *container.Container, name string) error
7777
7878// cleanupContainer unregisters a container from the daemon, stops stats
7979// collection and cleanly removes contents and metadata from the filesystem.
80- func (daemon * Daemon ) cleanupContainer (container * container.Container , forceRemove , removeVolume bool ) ( err error ) {
80+ func (daemon * Daemon ) cleanupContainer (container * container.Container , forceRemove , removeVolume bool ) error {
8181 if container .IsRunning () {
8282 if ! forceRemove {
8383 state := container .StateString ()
@@ -92,15 +92,12 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, forceRemo
9292 return fmt .Errorf ("Could not kill running container %s, cannot remove - %v" , container .ID , err )
9393 }
9494 }
95- if ! system .IsOSSupported (container .OS ) {
96- return fmt .Errorf ("cannot remove %s: %s " , container .ID , system .ErrNotSupportedOperatingSystem )
97- }
9895
9996 // stop collection of stats for the container regardless
10097 // if stats are currently getting collected.
10198 daemon .statsCollector .StopCollection (container )
10299
103- if err = daemon .containerStop (container , 3 ); err != nil {
100+ if err : = daemon .containerStop (container , 3 ); err != nil {
104101 return err
105102 }
106103
@@ -119,8 +116,7 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, forceRemo
119116 // When container creation fails and `RWLayer` has not been created yet, we
120117 // do not call `ReleaseRWLayer`
121118 if container .RWLayer != nil {
122- err := daemon .imageService .ReleaseLayer (container .RWLayer , container .OS )
123- if err != nil {
119+ if err := daemon .imageService .ReleaseLayer (container .RWLayer ); err != nil {
124120 err = errors .Wrapf (err , "container %s" , container .ID )
125121 container .SetRemovalError (err )
126122 return err
@@ -129,18 +125,18 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, forceRemo
129125 }
130126
131127 if err := system .EnsureRemoveAll (container .Root ); err != nil {
132- e : = errors .Wrapf (err , "unable to remove filesystem for %s" , container .ID )
133- container .SetRemovalError (e )
134- return e
128+ err = errors .Wrapf (err , "unable to remove filesystem for %s" , container .ID )
129+ container .SetRemovalError (err )
130+ return err
135131 }
136132
137133 linkNames := daemon .linkIndex .delete (container )
138134 selinux .ReleaseLabel (container .ProcessLabel )
139135 daemon .idIndex .Delete (container .ID )
140136 daemon .containers .Delete (container .ID )
141137 daemon .containersReplica .Delete (container )
142- if e := daemon .removeMountPoints (container , removeVolume ); e != nil {
143- logrus .Error (e )
138+ if err := daemon .removeMountPoints (container , removeVolume ); err != nil {
139+ logrus .Error (err )
144140 }
145141 for _ , name := range linkNames {
146142 daemon .releaseName (name )
0 commit comments