# Run command in another running container in machine

**URL:** <https://drone.discourse.group/t/run-command-in-another-running-container-in-machine/10996>\
**Category:** Drone Support\
**Created:** [May 24, 2019, 6:48pm UTC](https://drone.discourse.group/t/run-command-in-another-running-container-in-machine/10996 "2019-05-24T18:48:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eucleciojosias](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/eucleciojosias/32/5482_2.png) [@eucleciojosias](https://drone.discourse.group/u/eucleciojosias)\
**Post date:** [May 24, 2019, 6:48pm UTC](https://drone.discourse.group/t/run-command-in-another-running-container-in-machine/10996/1 "2019-05-24T18:48:43Z")

</div>

I have a range of containers that are running my application like my webserver container, mysql, container, memcached container and so on. I have a script that run my API tests (e.g `./api-test.sh`), but to work it has to be executed into my webserver container because it depends on database and other configs in the whole stack.

There’s a way to pipeline run this command (`./api-test.sh`) in my another container running in the same machine that drone server is running?

The two main containers in my `docker-compose.yml`:

```auto
version: '3'
services:
    webserver:
        image: container_webserver
        ports:
            - "${CPF_WEBSERVER_PORT}:80"
        volumes:
            - /tmp:/tmp
            - /etc/hosts:/etc/hosts
            - ${APP_PATH}:/var/www/html/app
        environment:
            - CPF_CANNON_TOKEN={SAMPLE}
        links:
            - mysql
        entrypoint: "sample"
    mysql:
        image: mysql:5.7.22
        ports:
            - "${CPF_DATABASE_MAIN_PORT}:3306"

```

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [May 28, 2019, 5:32am UTC](https://drone.discourse.group/t/run-command-in-another-running-container-in-machine/10996/2 "2019-05-28T05:32:42Z")

</div>

any reason you are not using service containers in your pipeline configuration? this would be the approach that we recommend.  
[https://docs.drone.io/user-guide/pipeline/services/](https://docs.drone.io/user-guide/pipeline/services/)  
[https://docs.drone.io/examples/service/](https://docs.drone.io/examples/service/)
