container_unix.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. // +build linux freebsd
  2. package container
  3. import (
  4. "fmt"
  5. "io/ioutil"
  6. "net"
  7. "os"
  8. "path/filepath"
  9. "strconv"
  10. "strings"
  11. "syscall"
  12. "github.com/Sirupsen/logrus"
  13. "github.com/docker/docker/api/types/network"
  14. "github.com/docker/docker/daemon/execdriver"
  15. derr "github.com/docker/docker/errors"
  16. "github.com/docker/docker/pkg/chrootarchive"
  17. "github.com/docker/docker/pkg/nat"
  18. "github.com/docker/docker/pkg/symlink"
  19. "github.com/docker/docker/pkg/system"
  20. "github.com/docker/docker/utils"
  21. "github.com/docker/docker/volume"
  22. "github.com/docker/libnetwork"
  23. "github.com/docker/libnetwork/netlabel"
  24. "github.com/docker/libnetwork/options"
  25. "github.com/docker/libnetwork/types"
  26. "github.com/opencontainers/runc/libcontainer/label"
  27. )
  28. const (
  29. // DefaultPathEnv is unix style list of directories to search for
  30. // executables. Each directory is separated from the next by a colon
  31. // ':' character .
  32. DefaultPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  33. // DefaultSHMSize is the default size (64MB) of the SHM which will be mounted in the container
  34. DefaultSHMSize int64 = 67108864
  35. )
  36. // Container holds the fields specific to unixen implementations. See
  37. // CommonContainer for standard fields common to all containers.
  38. type Container struct {
  39. CommonContainer
  40. // Fields below here are platform specific.
  41. AppArmorProfile string
  42. HostnamePath string
  43. HostsPath string
  44. ShmPath string
  45. MqueuePath string
  46. ResolvConfPath string
  47. SeccompProfile string
  48. }
  49. // CreateDaemonEnvironment returns the list of all environment variables given the list of
  50. // environment variables related to links.
  51. // Sets PATH, HOSTNAME and if container.Config.Tty is set: TERM.
  52. // The defaults set here do not override the values in container.Config.Env
  53. func (container *Container) CreateDaemonEnvironment(linkedEnv []string) []string {
  54. // if a domain name was specified, append it to the hostname (see #7851)
  55. fullHostname := container.Config.Hostname
  56. if container.Config.Domainname != "" {
  57. fullHostname = fmt.Sprintf("%s.%s", fullHostname, container.Config.Domainname)
  58. }
  59. // Setup environment
  60. env := []string{
  61. "PATH=" + DefaultPathEnv,
  62. "HOSTNAME=" + fullHostname,
  63. // Note: we don't set HOME here because it'll get autoset intelligently
  64. // based on the value of USER inside dockerinit, but only if it isn't
  65. // set already (ie, that can be overridden by setting HOME via -e or ENV
  66. // in a Dockerfile).
  67. }
  68. if container.Config.Tty {
  69. env = append(env, "TERM=xterm")
  70. }
  71. env = append(env, linkedEnv...)
  72. // because the env on the container can override certain default values
  73. // we need to replace the 'env' keys where they match and append anything
  74. // else.
  75. env = utils.ReplaceOrAppendEnvValues(env, container.Config.Env)
  76. return env
  77. }
  78. // TrySetNetworkMount attempts to set the network mounts given a provided destination and
  79. // the path to use for it; return true if the given destination was a network mount file
  80. func (container *Container) TrySetNetworkMount(destination string, path string) bool {
  81. if destination == "/etc/resolv.conf" {
  82. container.ResolvConfPath = path
  83. return true
  84. }
  85. if destination == "/etc/hostname" {
  86. container.HostnamePath = path
  87. return true
  88. }
  89. if destination == "/etc/hosts" {
  90. container.HostsPath = path
  91. return true
  92. }
  93. return false
  94. }
  95. // BuildHostnameFile writes the container's hostname file.
  96. func (container *Container) BuildHostnameFile() error {
  97. hostnamePath, err := container.GetRootResourcePath("hostname")
  98. if err != nil {
  99. return err
  100. }
  101. container.HostnamePath = hostnamePath
  102. if container.Config.Domainname != "" {
  103. return ioutil.WriteFile(container.HostnamePath, []byte(fmt.Sprintf("%s.%s\n", container.Config.Hostname, container.Config.Domainname)), 0644)
  104. }
  105. return ioutil.WriteFile(container.HostnamePath, []byte(container.Config.Hostname+"\n"), 0644)
  106. }
  107. // GetEndpointInNetwork returns the container's endpoint to the provided network.
  108. func (container *Container) GetEndpointInNetwork(n libnetwork.Network) (libnetwork.Endpoint, error) {
  109. endpointName := strings.TrimPrefix(container.Name, "/")
  110. return n.EndpointByName(endpointName)
  111. }
  112. func (container *Container) buildPortMapInfo(ep libnetwork.Endpoint) error {
  113. if ep == nil {
  114. return derr.ErrorCodeEmptyEndpoint
  115. }
  116. networkSettings := container.NetworkSettings
  117. if networkSettings == nil {
  118. return derr.ErrorCodeEmptyNetwork
  119. }
  120. driverInfo, err := ep.DriverInfo()
  121. if err != nil {
  122. return err
  123. }
  124. if driverInfo == nil {
  125. // It is not an error for epInfo to be nil
  126. return nil
  127. }
  128. if networkSettings.Ports == nil {
  129. networkSettings.Ports = nat.PortMap{}
  130. }
  131. if expData, ok := driverInfo[netlabel.ExposedPorts]; ok {
  132. if exposedPorts, ok := expData.([]types.TransportPort); ok {
  133. for _, tp := range exposedPorts {
  134. natPort, err := nat.NewPort(tp.Proto.String(), strconv.Itoa(int(tp.Port)))
  135. if err != nil {
  136. return derr.ErrorCodeParsingPort.WithArgs(tp.Port, err)
  137. }
  138. networkSettings.Ports[natPort] = nil
  139. }
  140. }
  141. }
  142. mapData, ok := driverInfo[netlabel.PortMap]
  143. if !ok {
  144. return nil
  145. }
  146. if portMapping, ok := mapData.([]types.PortBinding); ok {
  147. for _, pp := range portMapping {
  148. natPort, err := nat.NewPort(pp.Proto.String(), strconv.Itoa(int(pp.Port)))
  149. if err != nil {
  150. return err
  151. }
  152. natBndg := nat.PortBinding{HostIP: pp.HostIP.String(), HostPort: strconv.Itoa(int(pp.HostPort))}
  153. networkSettings.Ports[natPort] = append(networkSettings.Ports[natPort], natBndg)
  154. }
  155. }
  156. return nil
  157. }
  158. // BuildEndpointInfo sets endpoint-related fields on container.NetworkSettings based on the provided network and endpoint.
  159. func (container *Container) BuildEndpointInfo(n libnetwork.Network, ep libnetwork.Endpoint) error {
  160. if ep == nil {
  161. return derr.ErrorCodeEmptyEndpoint
  162. }
  163. networkSettings := container.NetworkSettings
  164. if networkSettings == nil {
  165. return derr.ErrorCodeEmptyNetwork
  166. }
  167. epInfo := ep.Info()
  168. if epInfo == nil {
  169. // It is not an error to get an empty endpoint info
  170. return nil
  171. }
  172. if _, ok := networkSettings.Networks[n.Name()]; !ok {
  173. networkSettings.Networks[n.Name()] = new(network.EndpointSettings)
  174. }
  175. networkSettings.Networks[n.Name()].EndpointID = ep.ID()
  176. iface := epInfo.Iface()
  177. if iface == nil {
  178. return nil
  179. }
  180. if iface.MacAddress() != nil {
  181. networkSettings.Networks[n.Name()].MacAddress = iface.MacAddress().String()
  182. }
  183. if iface.Address() != nil {
  184. ones, _ := iface.Address().Mask.Size()
  185. networkSettings.Networks[n.Name()].IPAddress = iface.Address().IP.String()
  186. networkSettings.Networks[n.Name()].IPPrefixLen = ones
  187. }
  188. if iface.AddressIPv6() != nil && iface.AddressIPv6().IP.To16() != nil {
  189. onesv6, _ := iface.AddressIPv6().Mask.Size()
  190. networkSettings.Networks[n.Name()].GlobalIPv6Address = iface.AddressIPv6().IP.String()
  191. networkSettings.Networks[n.Name()].GlobalIPv6PrefixLen = onesv6
  192. }
  193. return nil
  194. }
  195. // UpdateJoinInfo updates network settings when container joins network n with endpoint ep.
  196. func (container *Container) UpdateJoinInfo(n libnetwork.Network, ep libnetwork.Endpoint) error {
  197. if err := container.buildPortMapInfo(ep); err != nil {
  198. return err
  199. }
  200. epInfo := ep.Info()
  201. if epInfo == nil {
  202. // It is not an error to get an empty endpoint info
  203. return nil
  204. }
  205. if epInfo.Gateway() != nil {
  206. container.NetworkSettings.Networks[n.Name()].Gateway = epInfo.Gateway().String()
  207. }
  208. if epInfo.GatewayIPv6().To16() != nil {
  209. container.NetworkSettings.Networks[n.Name()].IPv6Gateway = epInfo.GatewayIPv6().String()
  210. }
  211. return nil
  212. }
  213. // UpdateSandboxNetworkSettings updates the sandbox ID and Key.
  214. func (container *Container) UpdateSandboxNetworkSettings(sb libnetwork.Sandbox) error {
  215. container.NetworkSettings.SandboxID = sb.ID()
  216. container.NetworkSettings.SandboxKey = sb.Key()
  217. return nil
  218. }
  219. // BuildCreateEndpointOptions builds endpoint options from a given network.
  220. func (container *Container) BuildCreateEndpointOptions(n libnetwork.Network) ([]libnetwork.EndpointOption, error) {
  221. var (
  222. portSpecs = make(nat.PortSet)
  223. bindings = make(nat.PortMap)
  224. pbList []types.PortBinding
  225. exposeList []types.TransportPort
  226. createOptions []libnetwork.EndpointOption
  227. )
  228. if n.Name() == "bridge" || container.NetworkSettings.IsAnonymousEndpoint {
  229. createOptions = append(createOptions, libnetwork.CreateOptionAnonymous())
  230. }
  231. // Other configs are applicable only for the endpoint in the network
  232. // to which container was connected to on docker run.
  233. if n.Name() != container.HostConfig.NetworkMode.NetworkName() &&
  234. !(n.Name() == "bridge" && container.HostConfig.NetworkMode.IsDefault()) {
  235. return createOptions, nil
  236. }
  237. if container.Config.ExposedPorts != nil {
  238. portSpecs = container.Config.ExposedPorts
  239. }
  240. if container.HostConfig.PortBindings != nil {
  241. for p, b := range container.HostConfig.PortBindings {
  242. bindings[p] = []nat.PortBinding{}
  243. for _, bb := range b {
  244. bindings[p] = append(bindings[p], nat.PortBinding{
  245. HostIP: bb.HostIP,
  246. HostPort: bb.HostPort,
  247. })
  248. }
  249. }
  250. }
  251. ports := make([]nat.Port, len(portSpecs))
  252. var i int
  253. for p := range portSpecs {
  254. ports[i] = p
  255. i++
  256. }
  257. nat.SortPortMap(ports, bindings)
  258. for _, port := range ports {
  259. expose := types.TransportPort{}
  260. expose.Proto = types.ParseProtocol(port.Proto())
  261. expose.Port = uint16(port.Int())
  262. exposeList = append(exposeList, expose)
  263. pb := types.PortBinding{Port: expose.Port, Proto: expose.Proto}
  264. binding := bindings[port]
  265. for i := 0; i < len(binding); i++ {
  266. pbCopy := pb.GetCopy()
  267. newP, err := nat.NewPort(nat.SplitProtoPort(binding[i].HostPort))
  268. var portStart, portEnd int
  269. if err == nil {
  270. portStart, portEnd, err = newP.Range()
  271. }
  272. if err != nil {
  273. return nil, derr.ErrorCodeHostPort.WithArgs(binding[i].HostPort, err)
  274. }
  275. pbCopy.HostPort = uint16(portStart)
  276. pbCopy.HostPortEnd = uint16(portEnd)
  277. pbCopy.HostIP = net.ParseIP(binding[i].HostIP)
  278. pbList = append(pbList, pbCopy)
  279. }
  280. if container.HostConfig.PublishAllPorts && len(binding) == 0 {
  281. pbList = append(pbList, pb)
  282. }
  283. }
  284. createOptions = append(createOptions,
  285. libnetwork.CreateOptionPortMapping(pbList),
  286. libnetwork.CreateOptionExposedPorts(exposeList))
  287. if container.Config.MacAddress != "" {
  288. mac, err := net.ParseMAC(container.Config.MacAddress)
  289. if err != nil {
  290. return nil, err
  291. }
  292. genericOption := options.Generic{
  293. netlabel.MacAddress: mac,
  294. }
  295. createOptions = append(createOptions, libnetwork.EndpointOptionGeneric(genericOption))
  296. }
  297. return createOptions, nil
  298. }
  299. // SetupWorkingDirectory sets up the container's working directory as set in container.Config.WorkingDir
  300. func (container *Container) SetupWorkingDirectory() error {
  301. if container.Config.WorkingDir == "" {
  302. return nil
  303. }
  304. container.Config.WorkingDir = filepath.Clean(container.Config.WorkingDir)
  305. pth, err := container.GetResourcePath(container.Config.WorkingDir)
  306. if err != nil {
  307. return err
  308. }
  309. pthInfo, err := os.Stat(pth)
  310. if err != nil {
  311. if !os.IsNotExist(err) {
  312. return err
  313. }
  314. if err := system.MkdirAll(pth, 0755); err != nil {
  315. return err
  316. }
  317. }
  318. if pthInfo != nil && !pthInfo.IsDir() {
  319. return derr.ErrorCodeNotADir.WithArgs(container.Config.WorkingDir)
  320. }
  321. return nil
  322. }
  323. // appendNetworkMounts appends any network mounts to the array of mount points passed in
  324. func appendNetworkMounts(container *Container, volumeMounts []volume.MountPoint) ([]volume.MountPoint, error) {
  325. for _, mnt := range container.NetworkMounts() {
  326. dest, err := container.GetResourcePath(mnt.Destination)
  327. if err != nil {
  328. return nil, err
  329. }
  330. volumeMounts = append(volumeMounts, volume.MountPoint{Destination: dest})
  331. }
  332. return volumeMounts, nil
  333. }
  334. // NetworkMounts returns the list of network mounts.
  335. func (container *Container) NetworkMounts() []execdriver.Mount {
  336. var mounts []execdriver.Mount
  337. shared := container.HostConfig.NetworkMode.IsContainer()
  338. if container.ResolvConfPath != "" {
  339. if _, err := os.Stat(container.ResolvConfPath); err != nil {
  340. logrus.Warnf("ResolvConfPath set to %q, but can't stat this filename (err = %v); skipping", container.ResolvConfPath, err)
  341. } else {
  342. label.Relabel(container.ResolvConfPath, container.MountLabel, shared)
  343. writable := !container.HostConfig.ReadonlyRootfs
  344. if m, exists := container.MountPoints["/etc/resolv.conf"]; exists {
  345. writable = m.RW
  346. }
  347. mounts = append(mounts, execdriver.Mount{
  348. Source: container.ResolvConfPath,
  349. Destination: "/etc/resolv.conf",
  350. Writable: writable,
  351. Propagation: volume.DefaultPropagationMode,
  352. })
  353. }
  354. }
  355. if container.HostnamePath != "" {
  356. if _, err := os.Stat(container.HostnamePath); err != nil {
  357. logrus.Warnf("HostnamePath set to %q, but can't stat this filename (err = %v); skipping", container.HostnamePath, err)
  358. } else {
  359. label.Relabel(container.HostnamePath, container.MountLabel, shared)
  360. writable := !container.HostConfig.ReadonlyRootfs
  361. if m, exists := container.MountPoints["/etc/hostname"]; exists {
  362. writable = m.RW
  363. }
  364. mounts = append(mounts, execdriver.Mount{
  365. Source: container.HostnamePath,
  366. Destination: "/etc/hostname",
  367. Writable: writable,
  368. Propagation: volume.DefaultPropagationMode,
  369. })
  370. }
  371. }
  372. if container.HostsPath != "" {
  373. if _, err := os.Stat(container.HostsPath); err != nil {
  374. logrus.Warnf("HostsPath set to %q, but can't stat this filename (err = %v); skipping", container.HostsPath, err)
  375. } else {
  376. label.Relabel(container.HostsPath, container.MountLabel, shared)
  377. writable := !container.HostConfig.ReadonlyRootfs
  378. if m, exists := container.MountPoints["/etc/hosts"]; exists {
  379. writable = m.RW
  380. }
  381. mounts = append(mounts, execdriver.Mount{
  382. Source: container.HostsPath,
  383. Destination: "/etc/hosts",
  384. Writable: writable,
  385. Propagation: volume.DefaultPropagationMode,
  386. })
  387. }
  388. }
  389. return mounts
  390. }
  391. // CopyImagePathContent copies files in destination to the volume.
  392. func (container *Container) CopyImagePathContent(v volume.Volume, destination string) error {
  393. rootfs, err := symlink.FollowSymlinkInScope(filepath.Join(container.BaseFS, destination), container.BaseFS)
  394. if err != nil {
  395. return err
  396. }
  397. if _, err = ioutil.ReadDir(rootfs); err != nil {
  398. if os.IsNotExist(err) {
  399. return nil
  400. }
  401. return err
  402. }
  403. path, err := v.Mount()
  404. if err != nil {
  405. return err
  406. }
  407. if err := copyExistingContents(rootfs, path); err != nil {
  408. return err
  409. }
  410. return v.Unmount()
  411. }
  412. // ShmResourcePath returns path to shm
  413. func (container *Container) ShmResourcePath() (string, error) {
  414. return container.GetRootResourcePath("shm")
  415. }
  416. // MqueueResourcePath returns path to mqueue
  417. func (container *Container) MqueueResourcePath() (string, error) {
  418. return container.GetRootResourcePath("mqueue")
  419. }
  420. // HasMountFor checks if path is a mountpoint
  421. func (container *Container) HasMountFor(path string) bool {
  422. _, exists := container.MountPoints[path]
  423. return exists
  424. }
  425. // UnmountIpcMounts uses the provided unmount function to unmount shm and mqueue if they were mounted
  426. func (container *Container) UnmountIpcMounts(unmount func(pth string) error) {
  427. if container.HostConfig.IpcMode.IsContainer() || container.HostConfig.IpcMode.IsHost() {
  428. return
  429. }
  430. var warnings []string
  431. if !container.HasMountFor("/dev/shm") {
  432. shmPath, err := container.ShmResourcePath()
  433. if err != nil {
  434. logrus.Error(err)
  435. warnings = append(warnings, err.Error())
  436. } else if shmPath != "" {
  437. if err := unmount(shmPath); err != nil {
  438. warnings = append(warnings, fmt.Sprintf("failed to umount %s: %v", shmPath, err))
  439. }
  440. }
  441. }
  442. if !container.HasMountFor("/dev/mqueue") {
  443. mqueuePath, err := container.MqueueResourcePath()
  444. if err != nil {
  445. logrus.Error(err)
  446. warnings = append(warnings, err.Error())
  447. } else if mqueuePath != "" {
  448. if err := unmount(mqueuePath); err != nil {
  449. warnings = append(warnings, fmt.Sprintf("failed to umount %s: %v", mqueuePath, err))
  450. }
  451. }
  452. }
  453. if len(warnings) > 0 {
  454. logrus.Warnf("failed to cleanup ipc mounts:\n%v", strings.Join(warnings, "\n"))
  455. }
  456. }
  457. // IpcMounts returns the list of IPC mounts
  458. func (container *Container) IpcMounts() []execdriver.Mount {
  459. var mounts []execdriver.Mount
  460. if !container.HasMountFor("/dev/shm") {
  461. label.SetFileLabel(container.ShmPath, container.MountLabel)
  462. mounts = append(mounts, execdriver.Mount{
  463. Source: container.ShmPath,
  464. Destination: "/dev/shm",
  465. Writable: true,
  466. Propagation: volume.DefaultPropagationMode,
  467. })
  468. }
  469. if !container.HasMountFor("/dev/mqueue") {
  470. label.SetFileLabel(container.MqueuePath, container.MountLabel)
  471. mounts = append(mounts, execdriver.Mount{
  472. Source: container.MqueuePath,
  473. Destination: "/dev/mqueue",
  474. Writable: true,
  475. Propagation: volume.DefaultPropagationMode,
  476. })
  477. }
  478. return mounts
  479. }
  480. func detachMounted(path string) error {
  481. return syscall.Unmount(path, syscall.MNT_DETACH)
  482. }
  483. // UnmountVolumes unmounts all volumes
  484. func (container *Container) UnmountVolumes(forceSyscall bool) error {
  485. var (
  486. volumeMounts []volume.MountPoint
  487. err error
  488. )
  489. for _, mntPoint := range container.MountPoints {
  490. dest, err := container.GetResourcePath(mntPoint.Destination)
  491. if err != nil {
  492. return err
  493. }
  494. volumeMounts = append(volumeMounts, volume.MountPoint{Destination: dest, Volume: mntPoint.Volume})
  495. }
  496. // Append any network mounts to the list (this is a no-op on Windows)
  497. if volumeMounts, err = appendNetworkMounts(container, volumeMounts); err != nil {
  498. return err
  499. }
  500. for _, volumeMount := range volumeMounts {
  501. if forceSyscall {
  502. if err := detachMounted(volumeMount.Destination); err != nil {
  503. logrus.Warnf("%s unmountVolumes: Failed to do lazy umount %v", container.ID, err)
  504. }
  505. }
  506. if volumeMount.Volume != nil {
  507. if err := volumeMount.Volume.Unmount(); err != nil {
  508. return err
  509. }
  510. }
  511. }
  512. return nil
  513. }
  514. // copyExistingContents copies from the source to the destination and
  515. // ensures the ownership is appropriately set.
  516. func copyExistingContents(source, destination string) error {
  517. volList, err := ioutil.ReadDir(source)
  518. if err != nil {
  519. return err
  520. }
  521. if len(volList) > 0 {
  522. srcList, err := ioutil.ReadDir(destination)
  523. if err != nil {
  524. return err
  525. }
  526. if len(srcList) == 0 {
  527. // If the source volume is empty copy files from the root into the volume
  528. if err := chrootarchive.CopyWithTar(source, destination); err != nil {
  529. return err
  530. }
  531. }
  532. }
  533. return copyOwnership(source, destination)
  534. }
  535. // copyOwnership copies the permissions and uid:gid of the source file
  536. // to the destination file
  537. func copyOwnership(source, destination string) error {
  538. stat, err := system.Stat(source)
  539. if err != nil {
  540. return err
  541. }
  542. if err := os.Chown(destination, int(stat.UID()), int(stat.GID())); err != nil {
  543. return err
  544. }
  545. return os.Chmod(destination, os.FileMode(stat.Mode()))
  546. }
  547. // TmpfsMounts returns the list of tmpfs mounts
  548. func (container *Container) TmpfsMounts() []execdriver.Mount {
  549. var mounts []execdriver.Mount
  550. for dest, data := range container.HostConfig.Tmpfs {
  551. mounts = append(mounts, execdriver.Mount{
  552. Source: "tmpfs",
  553. Destination: dest,
  554. Data: data,
  555. })
  556. }
  557. return mounts
  558. }