Container class
A docker container.
Constructors
- Container({required String containerid, required String imageid, required String created, required String status, required String ports, required String name})
- construct a docker container object from its parts.
-
Container.create(Image image, {List<
VolumeMount> volumes = const <VolumeMount>[], bool readonly = false}) -
Creates a container from
image
binding the passed Volumes into the container.factory
Properties
- containerid ↔ String
-
id of the container (the 12 char version)
getter/setter pair
- created ↔ String
-
the create date/time of this container.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setteroverride
- image → Image?
-
returns the image based on this image's id.
We actually refetch the list of images to ensure
we have the complete set of details.
no setter
- imageid ↔ String
-
the id of the image this container is based on.
getter/setter pair
- isRunning → bool
-
Returns true if the container is currently running.
no setter
- name ↔ String
-
The name of this container.
getter/setter pair
- ports ↔ String
-
The ports used by this container
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status ↔ String
-
The status of this container.
getter/setter pair
-
volumes
→ List<
Volume> -
returns the list of volumes attached to this container.
no setter
Methods
-
cli(
) → void - Attaches to the running container and starts a bash command prompt.
-
delete(
) → void - deletes this docker container.
-
isSame(
Container other) → bool -
Returns true if
other
has the same containerid as this container. We use the shorter 12 character version of the id. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
showLogs(
{int limit = 0}) → void -
writes this containers docker logs to the console
If
limit
is 0 (the default) all log lines a output. Iflimit
is > 0 then only the lastlimit
lines are output. -
start(
{List< String> ? args, String? argString, bool daemon = true}) → void -
Starts a docker container.
If
daemon
is true (the default) then the container is started as a daemon. Whendaemon
is false then we pass the interactive and attach arguments to the docker start command to allow full interaction. -
stop(
) → void - Tops tthe docker container if it is running. If the container is not running then no action is taken.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
covariant Container other) → bool -
The equality operator.
override