Package io.fabric8.docker.api.container

Examples of io.fabric8.docker.api.container.ContainerConfig


  }

  @Override
  public INodeStatistics getNodeStats(String nodeId) {
    if (nodeId != null) {
      CamelProcessorMBean processorMBean = camelContextNode.getProcessorMBean(nodeId);
      if (processorMBean != null) {
        return new ProcessorNodeStatistics(processorMBean);
      }
    }
    return null;
View Full Code Here


        return doCreateDockerContainer(options, parameters);
    }


    protected CreateDockerContainerMetadata doCreateDockerContainer(CreateDockerContainerOptions options, DockerCreateContainerParameters parameters) {
        ContainerConfig containerConfig = parameters.getContainerConfig();
        Map<String, String> environmentVariables = parameters.getEnvironmentVariables();
        String containerType = parameters.getContainerType();
        String jolokiaUrl = parameters.getJolokiaUrl();
        String name = options.getName();
        String dockerHost = dockerFactory.getDockerHost();
View Full Code Here

        metadata.setCreateOptions(options);
        return metadata;
    }

    protected ContainerConfig createContainerConfig(DockerCreateOptions options) {
        ContainerConfig containerConfig = new ContainerConfig();
        containerConfig.setImage(options.getImage());
        List<String> cmdList = options.getCmd();
        if (cmdList != null && cmdList.size() > 0) {
            containerConfig.setCmd(cmdList.toArray(new String[cmdList.size()]));
        }
        containerConfig.setEntrypoint(options.getEntrypoint());
        String workingDir = options.getWorkingDir();
        if (workingDir != null) {
            containerConfig.setWorkingDir(workingDir);
        }
        containerConfig.setAttachStdout(true);
        containerConfig.setAttachStderr(true);
        containerConfig.setTty(true);
        return containerConfig;
    }
View Full Code Here

            String image = config.getFabricDockerImage();
            String containerName = "fabric1";
            //String dockerHost = dockerFactory.getDockerHost();
            String dockerHost = "localhost";

            ContainerConfig containerConfig = new ContainerConfig();
            containerConfig.setImage(image);
            containerConfig.setAttachStdout(true);
            containerConfig.setAttachStderr(true);
            containerConfig.setTty(true);
            containerConfig.setEntrypoint(null);

            Map<String, Object> exposedPorts = new HashMap<>();

            Map<String, String> emptyMap = new HashMap<>();
            int[] rootContainerExposedPorts = config.getRootContainerExposedPorts();
            for (int exposedPort : rootContainerExposedPorts) {
                String portText = "" + exposedPort + "/tcp";
                exposedPorts.put(portText, emptyMap);
            }
            containerConfig.setExposedPorts(exposedPorts);
            System.out.println("Exposing ports: " + exposedPorts);

            Map<String, String> envVars = createChildEnvironmentVariables();
            envVars.put(EnvironmentVariables.FABRIC8_GLOBAL_RESOLVER, "manualip");
            envVars.put(EnvironmentVariables.FABRIC8_MANUALIP, dockerHost);
            envVars.put(EnvironmentVariables.RUNTIME_ID, containerName);
            envVars.put(EnvironmentVariables.KARAF_NAME, containerName);
            List<String> envList = Dockers.toEnvList(envVars);
            containerConfig.setEnv(envList);
            System.out.println("Creating docker container name " + containerName
                    + " with config: " + containerConfig);
            ContainerCreateStatus status = docker.containerCreate(containerConfig, containerName);
            rootDockerContainerId = status.getId();
            String[] warnings = status.getWarnings();
View Full Code Here


    @Test
    public void testContainerCreate() throws IOException {
        recordResponse("container/create-response");
        ContainerConfig cfg = new ContainerConfig();
        cfg.setImage("base");
        cfg.setCmd(new String[]{"date"});
        ContainerCreateStatus containerCreateStatus = docker.containerCreate(cfg, null);
        assertNotNull(containerCreateStatus);
        assertEquals(containerCreateStatus.getId(), "e90e34656806");
    }
View Full Code Here

            System.out.println(image);
        }
    }

    static String createContainer(Docker docker, String name) {
        ContainerConfig config = new ContainerConfig();
        config.setImage(image);
        if (!Strings.isNullOrEmpty(cmd)) {
            config.setCmd(new String[]{cmd});
        }
        config.setAttachStdout(true);
        config.setAttachStderr(true);
        System.out.println("Creating container: " + config);
        ContainerCreateStatus status = docker.containerCreate(config, name);
        System.out.println(status);
        return status.getId();
    }
View Full Code Here

        }

        DockerCreateContainerParameters parameters = new DockerCreateContainerParameters(options).invoke();
        doCreateDockerContainer(options, parameters);

        ContainerConfig containerConfig = parameters.getContainerConfig();
        Map<String, String> environmentVariables = parameters.getEnvironmentVariables();
        String containerType = parameters.getContainerType();

        ContainerCreateStatus status = null;
        CreateKubernetesContainerMetadata metadata = null;
View Full Code Here


    protected void doCreateDockerContainer(CreateKubernetesContainerOptions options, DockerCreateContainerParameters parameters) throws Exception {
        Kubernetes kubernetes = getKubernetes();
        Objects.notNull(kubernetes, "kubernetes");
        ContainerConfig containerConfig = parameters.getContainerConfig();
        Map<String, String> environmentVariables = parameters.getEnvironmentVariables();
        environmentVariables.put(EnvironmentVariables.FABRIC8_LISTEN_ADDRESS, "0.0.0.0");
        //environmentVariables.put(EnvironmentVariables.FABRIC8_FABRIC_ENVIRONMENT, "kubernetes");
        environmentVariables.remove(EnvironmentVariables.FABRIC8_GLOBAL_RESOLVER);
        environmentVariables.remove(EnvironmentVariables.FABRIC8_MANUALIP);
        String containerType = parameters.getContainerType();
        String jolokiaUrl = parameters.getJolokiaUrl();
        String name = options.getName();
        String image = containerConfig.getImage();
        Set<String> profileIds = options.getProfiles();
        String versionId = options.getVersion();
        FabricService service = getFabricService();

        PodSchema pod = new PodSchema();
View Full Code Here

   * @see
   * org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
   */
  @Override
  public Image getImage(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return getLevelImage(le);
    }
    return super.getImage(element);
  }
View Full Code Here

   * @see
   * org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
   */
  @Override
  public String getText(Object element) {
    LogEvent le = LogViewTabSection.toLogEvent(element);
    if (le != null) {
      return le.getLevel();
    }
    return super.getText(element);
  }
View Full Code Here

TOP

Related Classes of io.fabric8.docker.api.container.ContainerConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.