Open interactive terminal

Asked

Viewed 206 times

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 climbing as:

docker-compose up -d

1 answer

2


You are climbing the container correctly. To open a shell in this container, you need to run a Docker exec:

docker exec -it seu-container-mysql bash

To disconnect from the terminal, press:

Ctrl+p e Ctrl+q

Or:

Ctrl+d

Note that CTRL+d will terminate the open session by closing any Jobs you have left running. The first way just disconnects without killing the session.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.