Unverified Commit 924e1fef authored by Antoine RICHARD's avatar Antoine RICHARD Committed by GitHub

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
parent 28ed0bb6
......@@ -23,3 +23,5 @@ recordings/
**/*.egg-info/
# ignore isaac sim symlink
_isaac_sim?
# Docker history
docker/.isaac-lab-docker-history
......@@ -66,3 +66,6 @@ datasets
# Tests
tests/
# Docker history
.isaac-lab-docker-history
......@@ -99,7 +99,9 @@ RUN echo "export ISAACLAB_PATH=${ISAACLAB_PATH}" >> ${HOME}/.bashrc && \
echo "alias pip='${ISAACLAB_PATH}/_isaac_sim/python.sh -m pip'" >> ${HOME}/.bashrc && \
echo "alias pip3='${ISAACLAB_PATH}/_isaac_sim/python.sh -m pip'" >> ${HOME}/.bashrc && \
echo "alias tensorboard='${ISAACLAB_PATH}/_isaac_sim/python.sh ${ISAACLAB_PATH}/_isaac_sim/tensorboard'" >> ${HOME}/.bashrc && \
echo "export TZ=$(date +%Z)" >> ${HOME}/.bashrc
echo "export TZ=$(date +%Z)" >> ${HOME}/.bashrc && \
echo "shopt -s histappend" >> /root/.bashrc && \
echo "PROMPT_COMMAND='history -a'" >> /root/.bashrc
# make working directory as the Isaac Lab directory
# this is the default directory when the container is run
......
......@@ -60,6 +60,10 @@ x-default-isaac-lab-volumes: &default-isaac-lab-volumes
- type: volume
source: isaac-lab-data
target: ${DOCKER_ISAACLAB_PATH}/data_storage
# This volume is used to store the history of the bash shell
- type: bind
source: .isaac-lab-docker-history
target: ${DOCKER_USER_HOME}/.bash_history
x-default-isaac-lab-environment: &default-isaac-lab-environment
- ISAACSIM_PATH=${DOCKER_ISAACLAB_PATH}/_isaac_sim
......
......@@ -114,6 +114,11 @@ class ContainerInterface:
f"[INFO] Building the docker image and starting the container '{self.container_name}' in the"
" background...\n"
)
# Check if the container history file exists
container_history_file = self.context_dir / ".isaac-lab-docker-history"
if not container_history_file.exists():
# Create the file with sticky bit on the group
container_history_file.touch(mode=0o2644, exist_ok=True)
# build the image for the base profile if not running base (up will build base already if profile is base)
if self.profile != "base":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment