How to exit from a running block command container?

Viewed 1137

I use below content Dockerfile builded a alphine-test image:

FROM rarenicks/alphine 
WORKDIR /app
COPY ./src/ /app 
RUN echo 321 >> test.txt   
CMD tail -f test.txt 

you see the CDM tail -f test.txt is a block command.

when I run the image as a container:

[root@att dockerfiles]# docker run alphine-test:v1.0 
WARNING: IPv4 forwarding is disabled. Networking will not work.
321
^C
quit
^C
^Z
^P
^Z^X^C^

now I cannot exit from the container now.

1 Answers

You need to run the container in "interactive mode":

docker run --interactive --tty alphine-test:v1.0 
Related