Docker-toolbox is installed on the windows machine. I go into the container, for example: docker exec -it web / bin / sh
I can enter commands there.
How to access the history of input commands inside a container? In all consoles, this is done using the up arrow key
, here when you press this key, ^ [[A.
How to look at the history or at least call the previous command?
docker logs <container id> will show you all the output of the container run. If you're running it on ECS, you'll probably need to set DOCKER_HOST=tcp://ip:port for the host that ran the container. My container is already stopped. Using the cmd line doing, docker run -d image, it returns me the container id.
Use the docker service rollback command to roll back to the previous version of a service. After executing this command, the service is reverted to the configuration that was in place before the most recent docker service update command.
As @DavidMaze pointed out, regular shell located in /bin/sh
doesn't have the history feature unlike bash
located (simply put) in /bin/bash
related threads can be found here and here, and a more detailed explanation about the difference between the two can be found here
Usage:
when starting fresh container:
docker run -it <imagename:tag> /bin/bash
docker run -it --entrypoint /bin/bash imagename:tag
when connecting to existing container:
docker exec -it <containerid or containername> /bin/bash
The easier way is to type the command "bash" and then you'll be in bash with previous commands history.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With