Get the container id of a running docker container.

@param session the session to use.
@param containerName the name of the container, used in a grep filter.
@return the id of the container or null.
@throws JSchException
@throws IOException
331060
public static String getRunningDockerContainerId( Session session, String containerName ) throws JSchException, IOException {
        String command = "docker ps | grep " + containerName;
        String remoteResponseStr = launchACommand(session, command);
        if (remoteResponseStr.length() == 0) {
            return null;
        }

        List<String> containerIdsList = new ArrayList<>();
        String[] linesSplit = remoteResponseStr.split("\n");
        for( String line : linesSplit ) {
            String[] psSplit = line.split("\\s+");
            if (psSplit.length < 3) {
                throw new JSchException("Could not retrieve container data. Result was: " + line);
            }
            String cid = psSplit[0];
            containerIdsList.add(cid);
        }
        if (containerIdsList.size() > 1) {
            throw new JSchException("More than one container was identified with the given filters. Check your filters.");
        } else if (containerIdsList.size() == 0) {
            return null;
        }
        return containerIdsList.get(0);
    }
513837
def session_id(self):
        
        return None if not self.session or 'JSESSIONID' not in \
            self.session.cookies else 'JSESSIONID={}'.format(
                self.session.cookies['JSESSIONID'])
904160
public com.google.appengine.v1.ContainerInfo getContainer() {
    return container_ == null ? com.google.appengine.v1.ContainerInfo.getDefaultInstance() : container_;
  }
1020374
def container_name(self):
        
        if getattr(self, "_container_name", NotSpecified) is NotSpecified:
            self.container_name = "{0}-{1}".format(self.image_name.replace("/", "--").replace(":", "---"), str(uuid.uuid1()).lower())
        return self._container_name
407971
def _get_container_infos(config, container):
    '''
    
    '''
    client = _get_client(config)
    infos = None
    try:
        infos = _set_id(client.inspect_container(container))
    except Exception:
        pass
    return infos
104067
public int getSessionID()
    {
        Integer intSession = (Integer)m_hmSessions.get(this);
        if (intSession == null)
        {
            synchronized (m_hmSessions)
            {
                m_hmSessions.put(this, intSession = new Integer(m_iNextSession++));
            }
        }
        return intSession.intValue();
    }
176603
def _get_container(self):
        
        if not hasattr(self, "_container"):
            if self.use_pyrax:
                self._container = self.connection.create_container(self.container_name)
            else:
                self._container = None
        return self._container
686102
public static ContainerState getContainerState( String containerId, DockerClient dockerClient ) {

		ContainerState result = null;
		try {
			InspectContainerResponse resp = dockerClient.inspectContainerCmd( containerId ).exec();
			if( resp != null )
				result = resp.getState();

		} catch( Exception e ) {
			// nothing
		}

		return result;
	}
309272
private String getSessionId(final HttpSession sess) {
    try {
      if (sess == null) {
        return "NO-SESSIONID";
      } else {
        return sess.getId();
      }
    } catch (Throwable t) {
      return "SESSION-ID-EXCEPTION";
    }
  }
810373
protected Long getPersistedSessionId(String location, String identifier) {
        File sessionIdStore = new File(location + File.separator + identifier+ "-jbpmSessionId.ser");
        if (sessionIdStore.exists()) {
        	Long knownSessionId = null; 
            FileInputStream fis = null;
            ObjectInputStream in = null;
            try {
                fis = new FileInputStream(sessionIdStore);
                in = new ObjectInputStream(fis);
                
            	Object tmp = in.readObject();
            	if (tmp instanceof Integer) {
            		tmp = new Long((Integer) tmp);
            	}
        		knownSessionId = (Long) tmp;
                
                return knownSessionId.longValue();
                
            } catch (Exception e) {
                return 0L;
            } finally {
                if (in != null) {
                    try {
                        in.close();
                    } catch (IOException e) {
                    }
                }
                if (fis != null) {
                    try {
                        fis.close();
                    } catch (IOException e) {
                    }
                }
 
            }
            
        } else {
            return 0L;
        }
    }
499304
def get_container_ip(self, container):
        
        info = self.inspect_container(container)
        if not info:
            return None

        netInfo = info['NetworkSettings']
        if not netInfo:
            return None

        ip = netInfo['IPAddress']
        if not ip:
            return None

        return ip
39494
def _get_container_id(self, labels):
        
        namespace = CadvisorPrometheusScraperMixin._get_container_label(labels, "namespace")
        pod_name = CadvisorPrometheusScraperMixin._get_container_label(labels, "pod_name")
        container_name = CadvisorPrometheusScraperMixin._get_container_label(labels, "container_name")
        return self.pod_list_utils.get_cid_by_name_tuple((namespace, pod_name, container_name))
299257
public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
		if (this.sarlAnnotationType == null) {
			this.container = container;
			this.sarlAnnotationType = SarlFactory.eINSTANCE.createSarlAnnotationType();
			container.getMembers().add(this.sarlAnnotationType);
			if (!Strings.isEmpty(name)) {
				this.sarlAnnotationType.setName(name);
			}
		}
	}
498203
public org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer getContainerTarget(String containerName) {

        return m_targetContainers.get(containerName);
    }
1180285
public java.lang.String getContainer() {
    java.lang.Object ref = container_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      container_ = s;
      return s;
    }
  }
911753
public static String getSessionId(final HttpServletRequest pRequest) {
        HttpSession session = pRequest.getSession();

        return (session != null) ? session.getId() : null;
    }
229288
@Override
    public Container find(final FedoraSession session, final String path) {
        final Node node = findNode(session, path);

        return cast(node);
    }