Bugfix: added sleep 5 to allow the container to be created
before starting it.
JIRA: FUNCTEST-85
Change-Id: I8d282d1aa3a18bb6cc9471a1416a8bb7de701198
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
echo "Functest: Running docker run command: docker run -i -e $envs opnfv/functest /bin/bash &"
docker run -i -e $envs opnfv/functest /bin/bash &
docker ps -a
echo "Functest: Running docker run command: docker run -i -e $envs opnfv/functest /bin/bash &"
docker run -i -e $envs opnfv/functest /bin/bash &
docker ps -a
container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
echo "Container ID=${container_id}"
if [ -z ${container_id} ]; then
container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
echo "Container ID=${container_id}"
if [ -z ${container_id} ]; then
- echo "Cannot find opnfv/functest container ID. Please check if it is existing."
+ echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing."
- docker start $container_id
+ echo "Starting the container: docker start ${container_id}"
+ docker start ${container_id}
+ sleep 5
+ docker ps
+ if [ $(docker ps | grep opnfv/functest | wc -l) == 0 ]; then
+ echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..."
+ exit 1
+ fi
cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh"
- docker exec $container_id $cmd
+ echo "Executing command inside the docker: ${cmd}"
+ docker exec ${container_id} ${cmd}