Docker : transfer data from vitual machine to docker container

  docker, docker-compose, gitea, pgadmin-4, postgresql

I have a Gitea server running on a virtual machine with a database of PostgreSQL.
I did the migration with docker-compose.

This is the file docker-compose.yml

version: "3"

networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:1.15.5
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=db:5432
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=gitea
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3333:3000"
      - "222:22"
    extra_hosts:
      - "localhost:192.168.2.10"  
    depends_on:
      - db

  db:
    image: postgres:10
    restart: always
    container_name: db_test
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=gitea
      - POSTGRES_DB=gitea
    networks:
      - gitea
    volumes:
      - ./postgres:/var/lib/postgresql/data
    ports:
      - "5432:5432"  

This is part of the .ini descriptor file in the virtual machine :

[database]
DB_TYPE  = postgres
HOST     = 127.0.0.1:5432
NAME     = ***********
USER     = ***********
PASSWD   = ***********
SSL_MODE = disable
CHARSET  = utf8
PATH     = /var/lib/gitea/data/gitea.db

I have done data migration from /var/lib/gitea/data/gitea.db to ./postgres to get old data to new gitea server.

When I run docker-compose up -d I can’t access Gitea server.

When I run docker-compose logs it shows:
[E] ORM engine initialization attempt #1/10 failed. Error: dial tcp: lookup db on 127.0.0.11:53: no such host

Where did I go wrong and is there any other way to back up the data.

Source: Docker Questions

LEAVE A COMMENT