Merge pull request #4624 from creack/fix_apparmor_init
Fix issue when /etc/apparmor.d does not exists
This commit is contained in:
		
						commit
						26f4981284
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		|  | @ -5,6 +5,7 @@ import ( | |||
| 	"io/ioutil" | ||||
| 	"os" | ||||
| 	"os/exec" | ||||
| 	"path" | ||||
| ) | ||||
| 
 | ||||
| const DefaultProfilePath = "/etc/apparmor.d/docker" | ||||
|  | @ -85,6 +86,11 @@ func InstallDefaultProfile() error { | |||
| 		return nil | ||||
| 	} | ||||
| 
 | ||||
| 	// Make sure /etc/apparmor.d exists | ||||
| 	if err := os.MkdirAll(path.Dir(DefaultProfilePath), 0755); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
| 	if err := ioutil.WriteFile(DefaultProfilePath, []byte(DefaultProfile), 0644); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue