Skip to content

Commit 924e1fe

Browse files
Adds support for bash history in docker (#2659)
# Description Adds support for bash history between docker start/stop cycles. ## Type of change - New feature (non-breaking change which adds functionality) ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
1 parent 28ed0bb commit 924e1fe

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ recordings/
2323
**/*.egg-info/
2424
# ignore isaac sim symlink
2525
_isaac_sim?
26+
# Docker history
27+
docker/.isaac-lab-docker-history

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ datasets
6666

6767
# Tests
6868
tests/
69+
70+
# Docker history
71+
.isaac-lab-docker-history

docker/Dockerfile.base

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ RUN echo "export ISAACLAB_PATH=${ISAACLAB_PATH}" >> ${HOME}/.bashrc && \
9999
echo "alias pip='${ISAACLAB_PATH}/_isaac_sim/python.sh -m pip'" >> ${HOME}/.bashrc && \
100100
echo "alias pip3='${ISAACLAB_PATH}/_isaac_sim/python.sh -m pip'" >> ${HOME}/.bashrc && \
101101
echo "alias tensorboard='${ISAACLAB_PATH}/_isaac_sim/python.sh ${ISAACLAB_PATH}/_isaac_sim/tensorboard'" >> ${HOME}/.bashrc && \
102-
echo "export TZ=$(date +%Z)" >> ${HOME}/.bashrc
102+
echo "export TZ=$(date +%Z)" >> ${HOME}/.bashrc && \
103+
echo "shopt -s histappend" >> /root/.bashrc && \
104+
echo "PROMPT_COMMAND='history -a'" >> /root/.bashrc
103105

104106
# make working directory as the Isaac Lab directory
105107
# this is the default directory when the container is run

docker/docker-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ x-default-isaac-lab-volumes: &default-isaac-lab-volumes
6060
- type: volume
6161
source: isaac-lab-data
6262
target: ${DOCKER_ISAACLAB_PATH}/data_storage
63+
# This volume is used to store the history of the bash shell
64+
- type: bind
65+
source: .isaac-lab-docker-history
66+
target: ${DOCKER_USER_HOME}/.bash_history
6367

6468
x-default-isaac-lab-environment: &default-isaac-lab-environment
6569
- ISAACSIM_PATH=${DOCKER_ISAACLAB_PATH}/_isaac_sim

docker/utils/container_interface.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ def start(self):
114114
f"[INFO] Building the docker image and starting the container '{self.container_name}' in the"
115115
" background...\n"
116116
)
117+
# Check if the container history file exists
118+
container_history_file = self.context_dir / ".isaac-lab-docker-history"
119+
if not container_history_file.exists():
120+
# Create the file with sticky bit on the group
121+
container_history_file.touch(mode=0o2644, exist_ok=True)
117122

118123
# build the image for the base profile if not running base (up will build base already if profile is base)
119124
if self.profile != "base":

0 commit comments

Comments
 (0)