Files
container/Sources/Services/ContainerSandboxService/Client/SandboxRoutes.swift
T
9895ba8d08 Add container copy/cp command for host-container file transfer (#1190)
## Type of Change
- [ ] Bug fix
- [x] New feature  
- [ ] Breaking change
- [x] Documentation update

## Motivation and Context
Adds the `container copy` (aliased as `cp`) command to copy files
between a running container and the local filesystem.

I saw [#1023](https://github.com/apple/container/pull/1023) and the
feedback from @dcantah — the previous attempt relied on tar being
installed inside the container.
This implementation takes the recommended approach:
file transfers go through the guest agent via the existing
`copyIn`/`copyOut` methods on the core `Containerization`, with no
dependency on container tooling.

## Testing
- [x] Tested locally
- [x] Added/updated tests
- [x] Added/updated docs

---------

Co-authored-by: jwhur <57657645+JaewonHur@users.noreply.github.com>
2026-05-20 10:03:36 -07:00

49 lines
2.3 KiB
Swift

//===----------------------------------------------------------------------===//
// Copyright © 2026 Apple Inc. and the container project authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
public enum SandboxRoutes: String {
/// Create an xpc endpoint to the sandbox instance.
case createEndpoint = "com.apple.container.sandbox/createEndpoint"
/// Bootstrap the sandbox instance and create the init process.
case bootstrap = "com.apple.container.sandbox/bootstrap"
/// Create a process in the sandbox.
case createProcess = "com.apple.container.sandbox/createProcess"
/// Start a process in the sandbox.
case start = "com.apple.container.sandbox/start"
/// Stop the sandbox.
case stop = "com.apple.container.sandbox/stop"
/// Return the current state of the sandbox.
case state = "com.apple.container.sandbox/state"
/// Kill a process in the sandbox.
case kill = "com.apple.container.sandbox/kill"
/// Resize the pty of a process in the sandbox.
case resize = "com.apple.container.sandbox/resize"
/// Wait on a process in the sandbox.
case wait = "com.apple.container.sandbox/wait"
/// Execute a new process in the sandbox.
case exec = "com.apple.container.sandbox/exec"
/// Dial a vsock port in the sandbox.
case dial = "com.apple.container.sandbox/dial"
/// Shutdown the sandbox service process.
case shutdown = "com.apple.container.sandbox/shutdown"
/// Get statistics for the sandbox.
case statistics = "com.apple.container.sandbox/statistics"
/// Copy a file or directory into the container.
case copyIn = "com.apple.container.sandbox/copyIn"
/// Copy a file or directory out of the container.
case copyOut = "com.apple.container.sandbox/copyOut"
}