[DOCKER] How to connect a container created later to an existing network

What you want to do

reference

Create

Create a network called net1


docker create network net1

Connection

docker-compose.yml


version: "3"
services:

  potmum:
    image: tukiyo3/potmum:20170807
    restart: always
    volumes:
     - /etc/localtime:/etc/localtime
     - ./db/production.sqlite3:/srv/potmum/db/production.sqlite3
     - ./attachment_files/:/srv/potmum/public/attachment_files/
    environment:
      PRIVATE_MODE: 0
      USE_ATTACHMENT_FILE: 1
      COLOR_THEME: "green"
      #
      USE_GITHUB: 0
      USE_DEVELOPER: 1

networks:
  default:
    external:
      name: net1

docker-compose.yml


version: "3"
services:

  nginx:
    image: nginx:alpine
    restart: always
    volumes:
      - ./nginx/htpasswd:/etc/nginx/htpasswd
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
    ports:
      - 80:80

networks:
  default:
    external:
      name: net1

Recommended Posts

How to connect a container created later to an existing network
How to make a Java container
Downgrade an existing app created with rails 5.2.4 to 5.1.6
How to deploy a container on AWS Lambda
How to get a heapdump from a Docker container
How to deploy a system created with Java (Wicket-Spring boot) to an on-campus server
How to use an array for a TreeMap key
How to solve when you cannot connect to DB with a new container because the port is assigned to the existing docker container
How to create a lightweight container image for Java apps
[iOS] [Objective-C] How to update a widget from an Objective-C app
How to get inside a container running on AWS Fargate
How to change a string in an array to a number in Ruby
How to leave a comment
How to handle an instance
How to insert a video
How to create a method
How to automatically operate a screen created in Java on Windows
How to deploy an app that references a local jar to heroku
How to create a web server on an EC2 instance on AWS
How to add columns to a table
How to sign a Minecraft MOD
How to make a JDBC driver
[Java] How to create a folder
How to insert an external library
How to write a ternary operator
How to connect Heroku and Sequel
[Swift] How to send a notification
How to make a splash screen
How to make a Jenkins plugin
How to make a Maven project
How to make a Java array
How to develop from VScode in a remote destination environment or a remote destination container environment
[Java] How to turn a two-dimensional array with an extended for statement
How to migrate a web application created in a local docker environment to AWS
Created a Docker container image for an OpenLDAP server based on Fedora
How to make an app with a plugin mechanism [C # and Java]
How to start a Docker container with a volume mounted in a batch file
[AWS] How to automatically deploy a Web application created with Rails 6 to ECR / ECS using CircleCI ① Preparation [Container deployment]
How to crop an image with libGDX
How to execute a contract using web3j
How to sort a List using Comparator
How to make a Java calendar Summary
A memorandum on how to use Eclipse
How to redo a deployment on Heroku
How to blur an image (super easy)
[Basic] How to write a Dockerfile Self-learning ②
How to insert a video in Rails
Introduced Vue.js to an existing Rails app
How to publish an application on Heroku
How to add a new hash / array
[Introduction to Java] How to write a Java program
How to create a Maven repository for 2020
How to remote debug Java 9 or later
How to make a Discord bot (Java)
How to define an inner class bean
How to print a Java Word document
[Swift5] How to create a splash screen
[rails] How to create a partial template
How to publish a library in jCenter
How to write an RSpec controller test
[SpringBoot] How to write a controller test