Dockerize Android Emulator for Testing Purpose – How to Push APK

hi i’m trying to setup few docker containers to do some automation testings using robotframework.
so far i’ve prepared 2 images like this:

1. “robotframework-2” image:
this contains only python 2.7.x and robotframework testing tools that obtained via pip install

2. “cic-appium” image:
this contains android sdk, android emulator, and appium server.
i issued docker run -d command to this image, so the container always up (not called by gitlab-ci.yml file).
this container will be called by “robotframework-2” to run android testings, since the emulator is located here.

there’s one more image that dev team used to build the apk, android-packer image.

for now, the gitlab-ci.yml file looks like this:

staging:
  environment: staging
  stage: build
  image: android-packer
  script:
    - <some script to build the APK here>
  only:
    - development
starttestand:
  environment: staging
  stage: test
  image: robotframework-2
  script:
    - robot --exitonfailure -i "android-test" --outputdir ./output Android/Androidcicil.robot
  only:
    - ci_tester

for now, i can obtain the APK generated by “staging” job, docker exec -it bash to “cic-appium” image, run adb install inside it, and run the “starttestand” job, manually.

my question is, how can i obtain the APK, copy that to already running container, “cic-appium” inside the “starttestand” job? what’s the best way to do that?

Source: StackOverflow