Open interactive terminal

0

I have the following Docker-compose:

version: "3.3"
services:
  mysql:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: mydb
      MYSQL_USER: root
      MYSQL_PASSWORD: root
    restart: always
    ports:
      - "3306:3306"

  web:
    image: php:7.0-apache
    volumes:
      - ../Desenvolvimento Web/:/var/www/html
    working_dir: /var/www/html
    depends_on:
      - mysql
    links:
      - mysql
    restart: always
    ports:
      - "80:80"

How can I upload these containers so I can connect to their terminal? I've tried uploading as:

docker-compose up -d
    
asked by anonymous 23.09.2017 / 15:00

1 answer

2

You are uploading the container correctly. To open a shell in this container, you need to run an docker exec :

docker exec -it seu-container-mysql bash

To disconnect from the terminal, type:

Ctrl+p e Ctrl+q

Or:

Ctrl+d

Note that CTRL + d will close the open session, closing any jobs that you have left running. The first form just disconnects without killing the session.

    
23.09.2017 / 16:21