Olá pessoal, tudo bem? Me deparei com o mesmo problema aqui...
Saída do console
Started by user Rafael Carreiro
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/todo-list-producao
provisioning config files...
copy managed file [.env-prod] to file:/var/lib/jenkins/workspace/todo-list-producao/.env
[todo-list-producao] $ /bin/sh /tmp/jenkins11804960267710059724.sh
docker: Error response from daemon: Conflict. The container name "/django-todolist-prod" is already in use by container "eda4ced86b28ce55795ca49e8ca3b75812a98feab446c33a4d85024ce0d27822". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
django-todolist-prod
dbe3e998f6cb4d7b9426449c9535d99dda966a8f791abe34ecaea452d7153270
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:75: mounting "/var/lib/jenkins/workspace/todo-list-producao/.env" to rootfs at "/usr/src/app/to_do/.env" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
Build step 'Execute shell' marked build as failure
[Slack Notifications] found #1 as previous completed, non-aborted build
[Slack Notifications] will send OnEveryFailureNotification because build matches and user preferences allow it
Finished: FAILURE
docker: Error response from daemon: Conflict. The container name "/django-todolist-prod" is already in use by container "eda4ced86b28ce55795ca49e8ca3b75812a98feab446c33a4d85024ce0d27822".
You have to remove (or rename) that container to be able to reuse that name.
Como sugerido na mensagem de erro, segui a lógica da pipeline anterior editando o shell script utilizado, adicionando como primeiro passo a remoção do container django-todolist-prod
.
Ficou assim:
#!/bin/sh
docker rm -f django-todolist-prod
{
docker run -d -p 80:8000 -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock -v /var/lib/jenkins/workspace/todo-list-producao/.env:/usr/src/app/to_do/.env --name=django-todolist-prod $image:latest
} || { # catch
docker rm -f django-todolist-prod
docker run -d -p 80:8000 -v /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock -v /var/lib/jenkins/workspace/todo-list-producao/.env:/usr/src/app/to_do/.env --name=django-todolist-prod $image:latest
}
Após buildar novamente surgiu outro problema:
Started by user Rafael Carreiro
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/todo-list-producao
provisioning config files...
copy managed file [.env-prod] to file:/var/lib/jenkins/workspace/todo-list-producao/.env
[todo-list-producao] $ /bin/sh /tmp/jenkins13658375700380712107.sh
django-todolist-prod
609915b8c04f25451c96af87c6ab3cacf23d298b92c2f37779e86d715abd1fcc
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:75: mounting "/var/lib/jenkins/workspace/todo-list-producao/.env" to rootfs at "/usr/src/app/to_do/.env" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
django-todolist-prod
e28ce4ea9534c6ba264e433cfe722baca929928b4fe968c8afc90a2c29556860
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:75: mounting "/var/lib/jenkins/workspace/todo-list-producao/.env" to rootfs at "/usr/src/app/to_do/.env" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
Build step 'Execute shell' marked build as failure
[Slack Notifications] found #2 as previous completed, non-aborted build
[Slack Notifications] will send OnEveryFailureNotification because build matches and user preferences allow it
Finished: FAILURE
- failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:75: mounting "/var/lib/jenkins/workspace/todo-list-producao/.env" to rootfs at "/usr/src/app/to_do/.env" caused: mount through procfd: not a directory: unknown:
- Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.