Ask questionsfeature request: docker cat command

Similar to docker cp, it would be really handy to have a docker cat command to print a file from a container or even test for its existence.

$ docker cat container:/var/run/status
status line 1
status line 2

$ docker cat container:/var/run/status >/dev/null || echo "File not found"

Answer questions flickerfly

For other looking, I was able to put together the comments here into this in order to deal with an entrypoint conflict.

docker run -it --rm -a stdout --entrypoint cat <image> <filename>

It would be nice if docker cat was aliased to docker run -it --rm -a stdout --entrypoint cat.

Related questions

start container failed with "failed to umount /var/lib/docker/containers/.../shm: no such file or directory" hot 122
start container failed with "failed to umount /var/lib/docker/containers/.../shm: no such file or directory" hot 76
upgrade docker-18.09.2-ce , shim.sock: bind: address already in use: unknown hot 56
runc regression - EPERM running containers from selinux hot 26
integration: "error reading the kernel parameter" errors during CI hot 26
Error response from daemon: rpc error: code = DeadlineExceeded desc = context deadline exceeded hot 24
Windows Server 2019 publish ports in swarm not working hot 24
Swarm restarts all containers hot 22
write unix /var/run/docker.sock->@: write: broken pipe hot 19
OCI runtime exec failed: exec failed: cannot exec a container that has stopped: unknown hot 18
"docker stack deploy">"rpc error: code = 3 desc = name must be valid as a DNS name component" hot 18
hcsshim::PrepareLayer failed in Win32: The parameter is incorrect hot 18
Docker 18.09.1 doesn't work with iptables v1.8.2 hot 17
manifest invalid error when pushing image to hot 17
Can't set net.ipv4.tcp_tw_reuse in docker 1.10.3 hot 15
Github User Rank List