zoukankan      html  css  js  c++  java
  • test_docker

    Dockerfile

    FROM gcc:latest
    MAINTAINER Pawel Szczur <public at pawelsz.eu>
    
    LABEL description="A linux C++ build environment."
    
    RUN apt-get update && apt-get install -y \
      cmake \
      gdb \
      libgtest-dev \
      libgoogle-glog-dev \
      libboost-all-dev \
      valgrind 
    
    ENV LD_LIBRARY_PATH=/libs
    ENV CPLUS_INCLUDE_PATH=/libs/include
    RUN mkdir /src
    RUN mkdir /build
    WORKDIR /build
    
    CMD ["/bin/bash"]
    

    Guides

    docker  version
    docker  images
    docker  search ubuntu
    docker pull ubuntu
    docker  rm ubuntu
    docker run ubuntu uname -a
    
    docker run --help 
          --name string     Assign a name to the container
      -p, --publish list    Publish a container's port(s) to the host
      -P, --publish-all     Publish all exposed ports to random ports
      -d, --detach          Run container in background and print container ID
      -t, --tty             Allocate a pseudo-TTY
      -i, --interactive     Keep STDIN open even if not attached
      
    docker ps --help 
      -a, --all             Show all containers (default shows just running)
      -f, --filter filter   Filter output based on conditions provided
          --format string   Pretty-print containers using a Go template
      -n, --last int        Show n last created containers (includes all states) (default -1)
      -l, --latest          Show the latest created container (includes all states)
          --no-trunc        Don't truncate output
      -q, --quiet           Only display container IDs
      -s, --size            Display total file sizes
      
    docker stats   #Display a live stream of container(s) resource usage statistics
    Options:
      -a, --all             Show all containers (default shows just running)
          --format string   Pretty-print images using a Go template
          --no-stream       Disable streaming stats and only pull the first result
          --no-trunc        Do not truncate output
    	  
    docker start ContainerID
    docker restart ContainerID
    docker stop ContainerID
    docker kill ContainerID
    docker rm ContainerID
    docker rm -f $(docker ps -a -q)
    
    docker run -dit -p8000:8000 gcc /bin/sh
    
    
    docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
    docker run -dit -p8000:8000 gcc /bin/sh
    docker run -dit -p8001:8001 gcc /bin/sh -c "while true; do echo hello world; sleep 1; done"
    docker logs -f -t --tail 50 ContainerID
    
    Usage:  docker logs [OPTIONS] CONTAINER
    Fetch the logs of a container
    Options:
          --details        Show extra details provided to logs
      -f, --follow         Follow log output
          --since string   Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) 
      -n, --tail string    Number of lines to show from the end of the logs 
      -t, --timestamps     Show timestamps
          --until string   Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z)
    
    docker top ContainerID   Display the running processes of a container
    docker inspect ContainerID   Return low-level information on Docker objects
    docker exec -it ContainerID /bin/bash
    docker attach b10796d14c14
    docker cp ContainerID:ContainerPath 宿主机Path
    
    

    test

    docker build -t gcc11_dev .
    #gcc -g -Og -std=c99 test.c -o test
    #valgrind --leak-check=full ./test
    ########need add demo.
    
  • 相关阅读:
    pandas 之 数据合并
    第一册:lesson sixty five.
    第一册:lesson sixty three。
    C#正则表达式。
    第一册:lesson sixty one.
    C#泛型。
    SQL命令入门。
    C#序列化与反序列化。
    第一册:lesson fifty nine。
    C#文件操作。
  • 原文地址:https://www.cnblogs.com/yan1345/p/15573578.html
Copyright © 2011-2022 走看看