Skip to content

Commit a560b10

Browse files
committed
create docker image file capable of running the experiments
1 parent f61a94a commit a560b10

File tree

9 files changed

+2245
-34
lines changed

9 files changed

+2245
-34
lines changed

Dockerfile

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Use the base image with VNC and Xubuntu
2+
FROM accetto/xubuntu-vnc-novnc:latest
3+
4+
# Ensure apt-get runs with root privileges
5+
USER root
6+
7+
# Fix potential directory permissions issue before running apt-get
8+
RUN mkdir -p /var/lib/apt/lists/partial
9+
10+
# Set environment variables for Java
11+
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
12+
ENV PATH="$JAVA_HOME/bin:$PATH"
13+
ENV DISPLAY=:1
14+
ENV QT_DEBUG_PLUGINS=1
15+
ENV QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms
16+
17+
# Prepend to LD_LIBRARY_PATH
18+
ENV LD_LIBRARY_PATH=/opt/CoppeliaSim_Pro_V4_1_0_Ubuntu18_04/programming/remoteApiBindings/java/lib/Ubuntu18_04:$LD_LIBRARY_PATH
19+
20+
# Prepend to JAVA_LIBRARY_PATH
21+
ENV JAVA_LIBRARY_PATH=/opt/CoppeliaSim_Pro_V4_1_0_Ubuntu18_04/programming/remoteApiBindings/java/lib/Ubuntu18_04:$JAVA_LIBRARY_PATH
22+
23+
# Install Java, necessary dependencies, and CoppeliaSim
24+
RUN apt-get update && \
25+
apt-get install -y \
26+
openjdk-11-jdk \
27+
wget \
28+
libx11-6 \
29+
libglu1-mesa \
30+
libxi6 \
31+
libxmu6 \
32+
libpng16-16 \
33+
fontconfig \
34+
libfreetype6 \
35+
qt5-qmake qtbase5-dev qtbase5-dev-tools \
36+
libqt5core5a libqt5gui5 libqt5widgets5 \
37+
libxcb1 libx11-xcb1 libxcb-glx0 \
38+
libxcb-util1 libxcb-icccm4 libxcb-image0 \
39+
libxcb-keysyms1 libxcb-render-util0 \
40+
libxcb-xinerama0 libxcb-randr0 \
41+
libxcb-shm0 libxcb-shape0 \
42+
libavcodec-dev \
43+
libavformat-dev \
44+
libswscale-dev \
45+
&& rm -rf /var/lib/apt/lists/*
46+
47+
48+
# Install CoppeliaSim (V-REP) in a known location
49+
RUN wget -q https://downloads.coppeliarobotics.com/V4_1_0/CoppeliaSim_Pro_V4_1_0_Ubuntu18_04.tar.xz -O /tmp/coppeliasim.tar.xz && \
50+
tar -xvf /tmp/coppeliasim.tar.xz -C /opt && \
51+
rm /tmp/coppeliasim.tar.xz
52+
53+
# Expose the VNC port (5901) and the HTTP port (8080) for noVNC
54+
EXPOSE 5901 8080
55+
56+
# Set the working directory
57+
WORKDIR /root
58+
59+
# Copy the local files into the container
60+
COPY . /root/rl_CSR
61+
62+
# Ensure the group 'headless' exists (if not, create it), and the user 'headless' exists
63+
RUN getent group headless || groupadd -g 1000 headless && \
64+
id -u headless || true
65+
66+
# Change ownership of /home/headless to the 'headless' user and group
67+
RUN chown -R headless:headless /home/headless
68+
69+
70+
# 1. Start VNC server
71+
#CMD bash -c "../dockerstartup/vnc_startup.sh"
72+
73+
# 2. Run CoppeliaSim in the background
74+
#RUN /opt/CoppeliaSim_Pro_V4_1_0_Ubuntu18_04/coppeliaSim.sh /root/rl_CSR/scenes/training_obj2.ttt &
75+
76+
# 3. Sleep and wait for CoppeliaSim to load (adjust the sleep time if necessary)
77+
#RUN sleep 10
78+
79+
# 4. Build and run Java application using Gradle
80+
#RUN cd /root/rl_CSR && JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 ./gradlew --configure-on-demand -x check run

dks.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
docker stop rl_csr_container
2+
docker rm rl_csr_container
3+
docker build -t rl_csr_image .
4+
#docker run -d -v /home/ic-unicamp/git/phd/SpecialIssue_CSR_RL/rl_CSR:/root/rl_CSR -p 5901:5901 -p 8080:8080 -e VNC_PW="numero42" -e VNC_PASSWORD="numero42" --name rl_csr_container rl_csr_image
5+
#docker logs --details rl_csr_container
6+
docker run -d -v /home/ic-unicamp/git/phd/SpecialIssue_CSR_RL/rl_CSR:/root/rl_CSR -p 5901:5901 -p 8080:8080 -e VNC_PW="numero42" -e VNC_PASSWORD="numero42" --name rl_csr_container rl_csr_image

docker/Commands

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#Build
2+
docker build -t rl_csr_image .
3+
4+
Run
5+
docker run -d -v /home/ic-unicamp/git/phd/SpecialIssue_CSR_RL/rl_CSR:/root/rl_CSR -p 5901:5901 -p 8080:8080 -e VNC_PW="numero42" -e VNC_PASSWORD="numero42" --name rl_csr_container rl_csr_image
6+
7+
# Logs / Debug
8+
docker logs --details rl_csr_container
9+
10+
# Stop
11+
docker stop rl_csr_container
12+
docker rm rl_csr_container
13+
14+
#link
15+
16+
http://172.17.0.2:6901/vnc.html
17+
18+
# Memory used
19+
docker system df
20+
21+
22+
# Prune
23+
24+
docker system prune -a
25+
26+
27+
28+
# Permissions
29+
chmod +x /root/rl_CSR/start.sh
30+
31+
chmod +x /root/rl_CSR/vrep.sh
32+
33+

docker/Prerequisites

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Prerequisites
2+
3+
Docker installed on your machine.
4+
Access to the Java program and the scene file for CoppeliaSim
5+
6+
Pull the accetto/xubuntu-vnc-novnc Docker Image
7+
This Docker image is a good base because it provides a lightweight Ubuntu environment with a VNC server and a NoVNC web interface for remote access.
8+
9+
Open a terminal and pull the Docker image:
10+
11+
docker pull accetto/xubuntu-vnc-novnc
12+
13+
14+

0 commit comments

Comments
 (0)