Class DockerContainer

  • All Implemented Interfaces:
    Container

    public class DockerContainer
    extends Object
    implements Container
    Instance of DockerContainer representing informations which are required for work with container. Class is providing basic work with container. This type of work is later executed in DockerManager.
    • Constructor Detail

      • DockerContainer

        public DockerContainer​(String id)
        Constructor
        Parameters:
        id - id of created container
      • DockerContainer

        public DockerContainer​(String name,
                               String id,
                               DockerManager dockerManager)
        Instantiates a new Docker container.
        Parameters:
        name - the name
        id - the id
        dockerManager - the docker manager
      • DockerContainer

        public DockerContainer​(String name,
                               String id)
        Instantiates a new Docker container.
        Parameters:
        name - the name
        id - the id
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Container
        Gets name.
        Specified by:
        getName in interface Container
        Returns:
        the name
      • setName

        public void setName​(String name)
        Sets name.
        Parameters:
        name - the name
      • getIpAddress

        public String getIpAddress​(Network network)
        Description copied from interface: Container
        Gets ip address.
        Specified by:
        getIpAddress in interface Container
        Parameters:
        network - the network
        Returns:
        the ip address
      • getId

        public String getId()
        Description copied from interface: Container
        Gets id.
        Specified by:
        getId in interface Container
        Returns:
        the id
      • setId

        public void setId​(String id)
        Sets id.
        Parameters:
        id - the id
      • getManager

        public Manager getManager()
        Gets manager.
        Returns:
        the manager
      • setManager

        public void setManager​(Manager manager)
        Sets manager.
        Parameters:
        manager - the manager
      • exists

        public boolean exists()
        Method returns if is container alive.
        Specified by:
        exists in interface Container
        Returns:
        returns if container is alive
      • connectToNetwork

        public void connectToNetwork​(List<Network> networks)
        Method provides connecting container to networks.
        Specified by:
        connectToNetwork in interface Container
        Parameters:
        networks - networks to which will be container connected
      • destroyContainer

        public void destroyContainer()
        Method provides soft delete of container (stop + delete).
        Specified by:
        destroyContainer in interface Container
      • getGatewayNetworkIp

        public String getGatewayNetworkIp()
        Method gathers ip of container's gateway.
        Returns:
        String Ip address of container gateway
      • getGatewayNetworkMask

        public Integer getGatewayNetworkMask()
        Method gathers CIDR mask of container's gateway.
        Returns:
        Integer CIDR mask of container gateway.