Tiven Wang
Wang Tiven April 25, 2017
425 favorite favorites
bookmark bookmark
share share

犀牛 在犀类的后代中,现仅残存有犀牛科的4属5种,主要分布在亚洲和非洲,其中分布在亚洲的犀牛已经濒临绝种,非洲犀牛因为还有保护措施尚有族群。主要是因为犀牛角作为药材获利不菲,现行非洲犀牛角主要由养殖者所提供。南非养殖者会将犀牛角砍下,等待约一年半后再度收成,而部分盗猎者会将犀牛直接杀死取角,随盗猎导致数量减少,现在也不容易买到真正的犀牛角,现在商贩还懂得以牛羊的蛋白质部位替代来获利,甚至用相似成分的猫狗爪磨成假货变换充数。

Basic Operations

Cleaning Up Stopped Containers

$ docker rm -v $(docker ps -aq -f status=exited)

> docker rm -v (docker ps -aq -f status=exited)

Accessing host machine from within docker container

Run docker container with option:

docker run --net=host ... or docker run --network host ...

Within the container to get the IP of the host:

route | awk '/^default/ { print $2 }' or ip route | awk '/^default/ { print $3 }'

stackoverflow.com - Let two Containers getting linked to eachother


Add entries to container hosts file (–add-host):

docker run --add-host="docker:"


docker run --add-host=docker: --rm -it byrnedo/alpine-curl -H "Accept: application/json" docker:8080/uaa/login

Accessing host machine from within docker container


In docker-compose use network_mode: “host”

And alse need extra_hosts when you get error

  - "moby:"

Add hostname mappings. Use the same values as the docker client --add-host parameter.

  - "somehost:"
  - "otherhost:"

An entry with the ip address and hostname will be created in /etc/hosts inside containers for this service, e.g:  somehost   otherhost

Docker Machine – moby: Name or service not known


Running Nodejs

$ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/app -w /usr/src/app node node your-daemon-or-script.js

> docker run -it --rm --name my-running-script -v "%cd%":/usr/src/app -w /usr/src/app node npm install

> docker run -it --rm --name my-running-script -v "%cd%":/usr/src/app -w /usr/src/app -p 6001:6001 node node router.js

Running Jekyll

Build a docker image using Dockerfile:

FROM jekyll/jekyll:latest

RUN gem install jekyll-gist

CMD jekyll

build the image:

docker build -t test/jekyll .

then run:

> docker run --rm -it -w /data -p 4000:4000 -v c:/Users/<User>/github/tiven.wang:/data test/jekyll bundle exec jekyll serve -s /data/

Running SAP Cloud Platform Application

Build a docker image using Dockerfile:

FROM maven:3.5.0-jdk-8

COPY neo-java-web-sdk-2.72.17 /usr/share/neo-java-web-sdk-2.72.17

RUN ln -s /usr/share/neo-java-web-sdk-2.72.17/tools/neo.sh /usr/bin/neo

CMD neo

build the image: docker build -t test/scp .


> docker run --rm -it -w /app -v C:/dev/github/myapp:/app -v C:/Users/<User>/.m2/repository:/root/.m2/repository test/scp mvn package -DskipTests

Run Tomcat7:

> docker run --rm -it -w /app -v C:/dev/github/myapp:/app -v C:/Users/<User>/.m2/repository:/root/.m2/repository -p 8080:8080 test/scp mvn tomcat7:run

Open HANA DB tunnel:

> docker run --rm -it -e "https_proxy=proxy:8080" -p 30015:30015 test/scp neo open-db-tunnel -h int.sap.hana.ondemand.com -u <User> -a ixxxxxxsapdev --id hanadb

Running Private Registry

Running: docker run -d -p 5000:5000 --restart always --name registry registry:2

Tagging: docker tag test/jekyll localhost:5000/test/jekyll

Pushing: docker push localhost:5000/test/jekyll

Running CloudFoundry CLI

docker run -v /workspace -it diegoteam/cf-cli

Running Puppet

docker run --rm -it -w /workspace -v C:/Users/C5235715/dockers/learning-puppet4:/workspace devopsil/puppet bash

Running Maven

docker run --rm -it -w /workspace -v C:/dev/works/onlingo:/workspace -v C:/Users/C5235715/.m2/repository:/root/.m2/repository maven:3.5.0-jdk-8 mvn archetype:generate -DinteractiveMode=false -Dversion=1.0.0-SNAPSHOT -DgroupId=com.sample -DartifactId=my-car-service -DarchetypeGroupId=org.apache.olingo -DarchetypeArtifactId=olingo-odata2-sample-cars-annotation-archetype -DarchetypeVersion=2.0.0


“New state of ‘nil’ is invalid”

Ah right, I get it now. Have verified just now that this is still an issue on docker master, but only when using the legacy (go-ansiterm emulated) console. Which means on any version of Windows before Windows 10, or Windows 10 with the console explicitly set to legacy mode. MC does run just fine on a Windows 10 client (with console in native/default mode) pointing to a Linux daemon:

Recommend: ConEmu with PowerShell on Windows

“New state of ‘nil’ is invalid” when attaching to container, probably related to UTF-8

Similar Posts


comments powered by Disqus
Back to Top