I have a big problem actually. I'm following this tutorial https://pusher.com/tutorials/carpooling-react-native-part-1/ but when I finally should execute this command docker-compose exec --user=laradock workspace bash a problem appears:
The problem
Can someone help me?
I tried to execute only docker-compose up -d apache2 php-fpm elasticsearch it's working but not "workspace".
Related
I was able to run a docker container but if I do sudo docker-compose up -d but how to reopen/watch the screen again if I need and close again. I am using ubuntu.
Thanks
In order to follow the logs of all of the containers that are included in the docker-compose.yml file, run the command docker-compose logs -f (probably with sudo in your case) in the same directory in which you already ran sudo docker-compose up -d. You can find more information on the command here.
You are probably looking for docker attach (documentation). Usage is:
docker attach [OPTIONS] CONTAINER
I'm on the part of the tutorial where it talks about data persistence.
First, I run this command to put a random number into a text file within an ubuntu image:
docker run -d ubuntu bash -c "shuf -i 1-10000 -n 1 -o /data.txt && tail -f /dev/null"
I think I understand this line pretty well.
Next, the instructions ask me to start a new container (the same image) and I will see that the file is not the same:
docker run -it ubuntu ls /
However, when I run the above command, I get the following error:
/ ls: cannot access 'C:/Program Files/Git/': No such file or directory
I'm running Windows 10 using Git Bash, and this is being done through VS Code.
For now, I've gotten around this issue by re-running the exact command (docker run -d ubuntu bash -c "shuf -i 1-10000 -n 1 -o /data.txt && tail -f /dev/null"), but I would like to know why the docker run -it ubuntu ls / instructions failed, and what the solution is?
I managed to solve the issue so I am posting the solution here in case people come across the same issue in the future: git bash changes absolute paths so it is something that should be disabled.
Put this into .bashrc to correct the way paths are handled:
# Workaround for Docker for Windows in Git Bash.
docker()
{
(export MSYS_NO_PATHCONV=1; "docker.exe" "$#")
}
Unfortunately, this doesn't work in scenarios where docker run is called from npm scripts, etc. Volume mapping will still break.
See here to continue exploring the issue and seeing possible workarounds
I was trying to open a second terminal un a docker with docker-compose.
First run the container with
docker-compose run my-centos bash
And when I try to open a second terminal
docker-compose exec my-centos bash
I get the message
ERROR:No container found for my_centos_1
If I search the name of running container I get
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
34a95b44f0a2 centos6 "bash" 9 minutes ago Up 9 minutes docker_my-centos_run_1
why docker-compose exec search docker_my_centos_1 and not docker_my-centos_run_1?
docker-compose is meant to run multi-container applications and is supposed to be used with docker-compose up. When you use docker-compose run, you make a special container that's not really meant for normal use.
Since docker-compose is just a wrapper around docker, you can still access this special container via the normal docker command:
docker exec docker_my-centos_run_1 bash
Otherwise I'd suggest start your container with docker-compose up. This makes it so that you can run the second bash in the way that you specified:
docker-compose exec my-centos bash
Note: I don't know if you can attach a TTY directly with docker-compose up, so you might need to run an extra docker-compose exec my-centos bash to get two TTYs.
you need to do "docker-compose up -d"
then try ur commands
I think you may be having trouble with the project name, because you're not telling Docker with project are you referring to.
I was facing this problem and it can be fixed adding the project name like:
docker-compose -p myprojectname ps
or
docker-compose -p myprojectname exec php_service composer install
This post explain it: https://codereviewvideos.com/blog/how-i-fixed-docker-compose-exec-error-no-container-found-for/
I solved this issue by first running
sudo systemctl restart docker
if you are using docker-compose run this command
docker-compose run web python manage.py makemigrations
I'm attempting to set up intrigue on linux mint, and to set up the development environment I'm using docker. I was able to successfully install it
sudo apt-get install docker.io
Currently I'm following a guide which is supposed to describe how to do all of this. Unfortunately it doesn't seem to match up. Here are the commands the guide is having me run:
git clone https://github.com/intrigueio/intrigue-core
cd intrigue-core
docker build .
docker run -i -t -p 7777:7777
Then it says that postgresql, redis, and intrigue-io should all start. It works up to the very last command. After building, I try to run and get this error:
"docker run" requires at least 1 argument(s).
It's not as if the guide is complicated to follow, so I'm just wondering if there is something I'm missing. Is the guide downright incorrect?
You would need to write at least the name of what service you want to run.
But I see they define a docker-compose file, so it might be even easier if you just install it and then run docker-compose up (you can add a -d in the end to make it run as a deamon)
Each time I run the command "docker-compose run web ..." it results in another container being added to Kitematic, so that I have a list of containers like "image-name_web_run_1" and so on with each run of docker-compose.
Is this expected behaviour? If so, how do I work around it?
It is expected. You can use docker-compose run --rm to have the container removed when it exits.
You can clean up these old containers using docker-compose down or docker-compose rm -a.
Do you mean new container? That is the expected behavior for docker-compose run, see: https://docs.docker.com/compose/reference/run/
Did you mean to use docker-compose exec?
e.g., docker-compose exec web /bin/sh
See: https://docs.docker.com/compose/reference/exec/