docker ps --filter "status=exited" | grep 'months ago' | awk '{print $1}' \
| xargs --no-run-if-empty docker rmdocker cp foo.txt mycontainer:/foo.txt
docker cp mycontainer:/foo.txt foo.txtfunction vcp() {
ssh $1 "docker cp \`docker ps -a|grep $2|awk '{print \$1}'|head -n1\`:$3 -" | tar xvf -
}docker inspect $CID | grep IPAddress | cut -d \" -f 4
ADDallows<src>to be an URL.- If the
<src>parameter ofADDis an archive in a recognised compression format, it will be unpacked
When you run docker like this: docker run -i -t ubuntu bash the entrypoint is the default /bin/sh -c, the image
is ubuntu and the command is bash.
The command is run via the entrypoint. i.e., the actual thing that gets executed is /bin/sh -c bash. This allowed
docker to implement RUN quickly by relying on the shell's parser. Later on, people asked to be able to customize
this so ENTRYPOINT and -entrypoint has been introduced.
Everything after ubuntu in the example above is the command and is passed to the entrypoint. When using the CMD
instruction, it is exactly as if you were doing docker run -i -t ubuntu <cmd>. <cmd> will be the parameter
of the entrypoint.
You will also get the same result if you instead type this command docker run -i -t ubuntu. You will still start
a bash shell in the container because of the ubuntu Dockerfile specified a default CMD: CMD ["bash"].
If you EXPOSE a port, the service in the container is not accessible from outside Docker, but from inside other Docker containers. So this is good for inter-container communication.
If you EXPOSE and -p a port, the service in the container is accessible from anywhere, even outside Docker.