stuzzo
stuzzo

Reputation: 1066

Why I can't see my files inside a docker container?

I'm a Docker newbie and I'm trying to setup my first project. To test how to play with it, I just cloned one ready-to-go project and I setup it (Project repo). As the guide claims if I access a specific url, I reach the homepage. To be more specific a symfony start page.

Moreover with this command

docker run -i -t testdocker_application /bin/bash

I'm able to login to the container.

My problem is if I try to go to the application folder through bash, the folder that I shared with my host is empty.

I tried with another project, but the result is the same.

Where I'm wrong?

Here some infos about my env:

Config:

application:
    build: code
    volumes:
        - ./symfony:/var/www/symfony
        - ./logs/symfony:/var/www/symfony/app/logs
    tty: true

Upvotes: 7

Views: 10270

Answers (1)

Adam B
Adam B

Reputation: 1774

Looks like you have a docker-compose.yml file but are running the image with docker. You don't actually need docker-compose to start a single container. If you just want to start the container your command should look like this:

docker run -ti -v $(pwd)/symfony:/var/www/symfony -v $(pwd)/logs/symfony:/var/www/symfony/app/logs testdocker_application /bin/bash

To use your docker-compose.yml start your container with docker-compose up. You would also need to add the following to drop into a shell.

stdin_open: true
command: /bin/bash

Upvotes: 4

Related Questions