Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tox is not working for me #3019

Open
gabrielBusta opened this issue Oct 17, 2023 · 8 comments
Open

tox is not working for me #3019

gabrielBusta opened this issue Oct 17, 2023 · 8 comments

Comments

@gabrielBusta
Copy link
Member

I see this error when I run tox

docker run-test-pre: PYTHONHASHSEED='3210842712'
docker run-test: commands[0] | docker build --build-arg PYTHON_VERSION=3.9 -t balrog_backend-docker-test -f Dockerfile.test .
ERROR: use `docker --context=default buildx` to switch to context "default"
ERROR: InvocationError for command /usr/local/bin/docker build --build-arg PYTHON_VERSION=3.9 -t balrog_backend-docker-test -f Dockerfile.test . (exited with code 1)
ERROR:   docker: commands failed
@gabrielBusta
Copy link
Member Author

diff --git a/tox.ini b/tox.ini
index 29af5bba..71076f4b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -14,7 +14,7 @@ usedevelop = false
 depends =
 skip_install = true
 commands =
-    docker build --build-arg PYTHON_VERSION={env:PYTHON_VERSION} -t balrog_backend-{envname}-test -f Dockerfile.test .
+    docker buildx build --build-arg PYTHON_VERSION={env:PYTHON_VERSION} -t balrog_backend-{envname}-test -f Dockerfile.test .
     docker run --rm -v {toxinidir}:/app -v balrog_backend-{envname}-tox:/app/.tox -e TOXENV={env:TOXENV} balrog_backend-{envname}-test test
 
 [testenv]

@gabrielBusta
Copy link
Member Author

Calling buildx directly helps.

@gabrielBusta
Copy link
Member Author

Now I see:

docker run-test: commands[1] | docker run -v /var/run/docker.sock:/var/run/docker.sock --rm -v /Users/gbustamante/workspace/balrog:/app -v balrog_backend-docker-tox:/app/.tox -e TOXENV=check,py39 balrog_backend-docker-test test                                                                                                                                                                                                             
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
ERROR: InvocationError for command /usr/local/bin/docker run -v /var/run/docker.sock:/var/run/docker.sock --rm -v /Users/gbustamante/workspace/balrog:/app -v balrog_backend-docker-tox:/app/.tox -e TOXENV=check,py39 balrog_backend-docker-test test (exited with code 125)
ERROR:   docker: commands failed

@gabrielBusta
Copy link
Member Author

Enabling the docker Unix socket did the trick and I was able to run tox locally.

Screenshot 2023-10-17 at 12 21 32

@gabrielBusta
Copy link
Member Author

@MelakuAlehegn is also having issues running tox locally

@MelakuAlehegn
Copy link
Contributor

I'm still experiencing it on my Linux machine @gabrielBusta

@godplayer56
Copy link
Contributor

Try to add your user to the docker group or use sudo that usually fixes these kind of issues.

@MelakuAlehegn
Copy link
Contributor

@godplayer56 Adding user to docker groups had resolved on my end. @gabrielBusta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants