Q:

Unable to attach to Docker container: ".: .: is a directory"

I am unable to attach to a Docker container after I start it. I use the following commands:
[root@docker-test ~]# docker start b1
b1
[root@docker-test ~]# docker exec -it b1 /bin/bash .
Error response from daemon: Container b1 is not running
[root@docker-test ~]# docker attach b1
You cannot attach to a stopped container, start it first

Trying to attach to the container immediately after building it also fails:
[root@docker-test ~]# docker run -it --name b5 build8 bash .
.: .: is a directory
[root@docker-test ~]#

Viewing the logs, with docker logs b1 shows:
.: .: is a directory
.: .: is a directory
.: .: is a directory
.: .: is a directory...etc etc.

Each time I try to start the container, another .: .: is a directory is added to the log.
I have restarted the Docker daemon, restarted the server, and reinstalled Docker but the error persists. I just recently started having this problem, Docker had been running fine before then. Googling this log entry hasn't turned up anything. Does anyone have any ideas? I would appreciate it very much.

A:

Try without the dot (.) like:
[root@docker-test ~]# docker exec -it b1 /bin/bash

Or:
docker run -it --name b5 build8 bash

That would start a bash process in the b1 container (assuming that bash is available).
When you specify the dot (.) after the bash command the bash tries to execute it as a command. But the . is a directory and no command.

