How-To Guides
Applications Guides

Add an Application Container Using Docker Compose

6min
you can add an application container to the applications > containers pane using docker compose see the docker hub nginx image page for more information you can also leverage docker compose in manufacturing connect see set up docker container configurations for an application release docid 23au4c7cym9vju2mrnekd for details for this use case, we will add a docker compose container, add and run an nginix container, verify that the resulting website is running, and then remove the container step 1 add a docker compose container to add a docker compose container in manufacturing connect edge, navigate to applications > containers the containers pane appears click run the enter command to run field appears enter the following docker run it d name compose v /var/run/docker sock /var/run/docker sock docker/compose\ latest /bin/sh click run the named container appears in the containers pane and displays a running state the container runs locally step 2 add the nginx container to add the nginx container from the containers pane, click the terminal icon next to the compose container created in step 1 the compose shell opens enter docker ps a and press enter a list of the running containers appears enter cd and press enter enter mkdir new and press enter enter cd new and press enter the directory changes to /new enter vi docker compose yaml and press enter the compose yaml file opens paste the following code into the compose yaml file as plain text version '3' services web image nginx volumes \ /templates\ /etc/nginx/templates ports \ "3000 80" environment \ nginx host=foobar com \ nginx port=80 press esc and enter \ wq to save and exit the compose yaml file you are returned to the compose shell from the /new directory, enter docker compose up and press enter a series of commands appears, creating and attaching to new web 1 click the containers link at the top of the terminal to return to the containers pane, and then refresh the page the new web 1 for the nginix container appears and is running step 3 verify that nginx in running to verify that nginx is running open a new browser tab copy the ip address from the manufacturing connect edge browser tab paste the ip address in the new browser tab and add 3000 to the end for example https //192 168 7 16 3000 the welcome to nginx! page appears step 4 remove the nginx container you will now need to remove the nginx container to remove the nginx container from the compose terminal shell, press ctrl+c to stop the compose container enter docker compose down and press enter the new web 1 for the nginx container is removed step 5 verify the nginx container is removed click the containers link at the top of the terminal to return to the containers pane, and then refresh the page the new web 1 for the nginix container no longer appears example terminal code