Docker: enable IPv6 automatically in container

This commit is contained in:
Simon Duquennoy 2018-03-02 07:45:05 -08:00
parent 012d426642
commit b909fb2878
8 changed files with 12 additions and 30 deletions

View File

@ -14,7 +14,7 @@ before_install:
- ant -q -f $CNG_HOST_PATH/tools/cooja/build.xml jar
script: # The test script for each build.
- docker run --privileged -v $CNG_HOST_PATH:/home/user/contiki-ng -ti $DOCKER_IMG bash -c "make -C tests/??-$TEST_NAME";
- docker run --privileged -v $CNG_HOST_PATH:/home/user/contiki-ng -ti $DOCKER_IMG bash --login -c "make -C tests/??-$TEST_NAME";
# Check outcome of the test
- $CNG_HOST_PATH/tests/check-test.sh $CNG_HOST_PATH/tests/??-$TEST_NAME; exit $?;

View File

@ -17,9 +17,6 @@ java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$BASENAME.csc -c
JPID=$!
sleep 20
echo "Enabling IPv6"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Connect to the simlation
echo "Starting tunslip6"
make -C $CONTIKI/tools tunslip6

View File

@ -7,9 +7,6 @@ BASENAME=01-native-ping
IPADDR=fd00::302:304:506:708
echo "Enabling IPv6"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Starting Contiki-NG native node
echo "Starting native node"
make -C $CONTIKI/examples/hello-world > make.log 2> make.err

View File

@ -10,9 +10,6 @@ IPADDR=fd00::302:304:506:708
declare -i OKCOUNT=0
declare -i TESTCOUNT=0
echo "Enabling IPv6"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Starting Contiki-NG native node
echo "Starting native CoAP server"
make -C $CONTIKI/examples/coap > make.log 2> make.err

View File

@ -18,9 +18,6 @@ java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$BASENAME.csc -c
JPID=$!
sleep 20
echo "Enabling IPv6"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Connect to the simlation
echo "Starting tunslip6"
make -C $CONTIKI/tools tunslip6

View File

@ -18,9 +18,6 @@ java -Xshare:on -jar $CONTIKI/tools/cooja/dist/cooja.jar -nogui=$BASENAME.csc -c
JPID=$!
sleep 20
echo "Enabling IPv6"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Connect to the simlation
echo "Starting native border-router"
nohup make -C $CONTIKI/examples/rpl-border-router/ connect-router-cooja TARGET=native >> $BASENAME.nbr.log 2>&1 &

View File

@ -7,9 +7,6 @@ BASENAME=06-lwm2m-test
IPADDR=fd00::302:304:506:708
echo "Enabling IPv6"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Starting Contiki-NG native node
echo "Starting native node - lwm2m/ipso objects"
make -C $CONTIKI/examples/ipso-objects > make.log 2> make.err

View File

@ -67,24 +67,24 @@ WORKDIR ${HOME}
RUN echo "#!/bin/bash\nant -Dbasedir=${COOJA} -f ${COOJA}/build.xml run" > ${HOME}/cooja && \
chmod +x ${HOME}/cooja
# Optional: download Contiki-NG and pre-compile Cooja.
# Else, use a Docker bind mount to share the repo with the host.
# Docker run option:
# -v <HOST_CONTIKI_NG_ABS_PATH>:/home/user/contiki-ng
#RUN git clone --recursive https://github.com/contiki-ng/contiki-ng.git ${CONTIKI_NG}
#RUN ant -q -f ${CONTIKI_NG}/tools/cooja/build.xml jar
# Enable IPv6 -- must be done at runtime, not in Dockerfile
#RUN sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Install coap-cli
RUN sudo apt-get install -y npm \
&& sudo apt-get clean \
&& sudo npm install coap-cli -g \
&& sudo ln -s /usr/bin/nodejs /usr/bin/node
# Optional: download Contiki-NG and pre-compile Cooja.
# Else, use a Docker bind mount to share the repo with the host.
# Docker run option:
# -v <HOST_CONTIKI_NG_ABS_PATH>:/home/user/contiki-ng
RUN git clone --recursive https://github.com/contiki-ng/contiki-ng.git ${CONTIKI_NG}
RUN ant -q -f ${CONTIKI_NG}/tools/cooja/build.xml jar
# Working directory
WORKDIR ${CONTIKI_NG}
# Enable IPv6 -- must be done at runtime, not in Dockerfile
RUN echo "sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 > /dev/null" >> /home/user/.profile
# Start a bash
CMD bash
CMD bash --login