Container represents abstract API for container managers. It is now implemented by conu.backend.docker.image.DockerContainer
Container class definition which contains abstract methods. The instances should call the constructor
Parameters: |
|
---|
copy a file or a directory from container to host system
Parameters: |
|
---|---|
Returns: | None |
copy a file or a directory from host system to a container
Parameters: |
|
---|---|
Returns: | None |
remove this container; kwargs indicate that some container runtimes might accept more parameters
Parameters: | force – bool, if container engine supports this, force the functionality |
---|---|
Returns: | None |
execute a command in this container
Parameters: |
|
---|---|
Returns: | str (output) or iterator |
get exit code of container. Return value is 0 for running and created containers
Returns: | int |
---|
Return all known IPv4 addresses of this container. It may be possible that the container has disabled networking: in that case, the list is empty
Returns: | list of str |
---|
Return all known IPv6 addresses of this container. It may be possible that the container has disabled networking: in that case, the list is empty
Returns: | list of str |
---|
get unique identifier of this container
Returns: | str |
---|
return cached metadata by default
Parameters: | refresh – bool, returns up to date metadata if set to True |
---|---|
Returns: | dict |
get process identifier of the root process in the container
Returns: | int |
---|
get ports specified in container metadata
Returns: | list of str |
---|
Get status of container
Returns: | Status of container |
---|
perform a HTTP request
Parameters: |
|
---|---|
Returns: | dict |
check if given port is open and receiving connections
Parameters: |
|
---|---|
Returns: | True if the connection has been established inside timeout, False otherwise |
returns True if the container is running, this method should always ask the API and should not use a cached value
Returns: | bool |
---|
send a signal to this container (bear in mind that the process won’t have time to shutdown properly and your service may end up in an inconsistent state)
Parameters: | signal – str or int, signal to use for killing the container (SIGKILL by default) |
---|---|
Returns: | None |
Get logs from this container.
Parameters: | follow – bool, provide new logs as they come |
---|---|
Returns: | iterator |
mount container filesystem
Parameters: | mount_point – str, directory where the filesystem will be mounted |
---|---|
Returns: | instance of Filesystem |
Return name of this container.
Returns: | str |
---|
open a TCP connection to service running in the container, if port is None and container exposes only a single port, connect to it, otherwise raise an exception
Parameters: | port – int or None |
---|---|
Returns: | socket |
start current container - the container has to be created
Returns: | None |
---|
Provide current, up-to-date status of this container. This method should not use cached value. Implementation of this method should clearly state list of possible values to get from this method
Returns: | str |
---|
stop this container
Returns: | None |
---|
Block until the container stops, then return its exit code.
Parameters: | timeout – int, Request timeout |
---|---|
Returns: | int, exit code |