Closed natea closed 5 years ago
If this is on the command line, you probably need to run docker-compose with sudo permissions -- have you tried that?
Isn't the mkdir
command being executed inside the Docker container? I don't see how using sudo
when executing the ./install.sh -l
command on my Mac would assist in a permission denied error inside the container. Unless that directory is mounted as a volume on my Mac?
It's probably the volume on your Mac -- when I've used docker-compose in the past, it requires sudo permission to run.
I've tried prefixing the command with sudo
but still get the permission denied error:
$ sudo docker-compose run --rm -e RAILS_ENV=production web rake autolab:populate
Starting local_db_1_e6351c097e85 ... done
Starting local_tango_1_b01116f87ab0 ... done
Creating Course AutoPopulated and config file
rake aborted!
Errno::EACCES: Permission denied @ dir_s_mkdir - /home/app/webapp/courses/AutoPopulated
/home/app/webapp/app/models/course.rb:94:in `init_course_folder'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:432:in `block in make_lambda'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:228:in `call'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:228:in `block in halting_and_conditional'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `call'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `block in call'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `each'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:506:in `call'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_create_callbacks'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/callbacks.rb:306:in `_create_record'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/timestamp.rb:57:in `_create_record'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/persistence.rb:502:in `create_or_update'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
/var/lib/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_save_callbacks'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/callbacks.rb:302:in `create_or_update'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/persistence.rb:120:in `save'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/validations.rb:37:in `save'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/attribute_methods/dirty.rb:21:in `save'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:286:in `block (2 levels) in save'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:347:in `block in with_transaction_returning_status'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:220:in `transaction'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:344:in `with_transaction_returning_status'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:286:in `block in save'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:301:in `rollback_active_record_state!'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/transactions.rb:285:in `save'
/var/lib/gems/2.2.0/gems/newrelic_rpm-3.17.2.327/lib/new_relic/agent/instrumentation/active_record_helper.rb:26:in `block in save'
/var/lib/gems/2.2.0/gems/newrelic_rpm-3.17.2.327/lib/new_relic/agent.rb:586:in `with_database_metric_name'
/var/lib/gems/2.2.0/gems/newrelic_rpm-3.17.2.327/lib/new_relic/agent/instrumentation/active_record_helper.rb:25:in `save'
/var/lib/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/persistence.rb:34:in `create'
/home/app/webapp/lib/tasks/autolab.rake:27:in `load_course'
/home/app/webapp/lib/tasks/autolab.rake:334:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.2.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => autolab:populate
(See full trace by running task with --trace)
It seems like it's trying to make this directory /home/app/webapp/courses/AutoPopulated
, but is it trying to do that on my Mac, or in the Docker container?
I went inside the container and tried to manually mkdir AutoPopulated
inside the /home/app/webapp/courses
directory, and still got the permission denied error, even logged in as root!
https://gist.github.com/natea/3e9af5fad60769399883e7a132d55184
what's weird is that the directory /home/app/webapp/courses
directory is owned by the root
user and the owner has write permissions to that directory.
drwxr-xr-x 2 root root 64 Nov 18 13:35 courses
So it's bewildering why the AutoPopulated
directory cannot be created in there. Is this a shared volume on the host OS?
Yup, from server/docker-compose.yml
, it looks like /home/app/webapp/courses
is mounted to ./Autolab/courses
. So it is trying to write to your MacOS -- I've no idea why that should be failing.
I looked at the attached volumes, and noticed that /home/app/webapp/courses
had been mounted on my local machine in the directory ~/Documents/code/autolab-oneclick/local/Autolab/courses
I checked the permissions of this directory courses
and it was set to 9999:9999
nateaune at natemacbookpro in ~/Documents/code/autolab-oneclick/local/Autolab (master●)
$ ls -l
total 168
-rw-r--r-- 1 nateaune staff 6449 Nov 18 08:35 CONTRIBUTING.md
-rw-r--r-- 1 nateaune staff 1748 Nov 18 08:35 Dockerfile
-rw-r--r-- 1 nateaune staff 3267 Nov 18 08:35 Gemfile
-rw-r--r-- 1 nateaune staff 8954 Nov 18 08:35 Gemfile.lock
-rw-r--r-- 1 nateaune staff 11324 Nov 18 08:35 LICENSE
-rw-r--r-- 1 nateaune staff 2860 Nov 18 08:35 README.md
-rwxr-xr-x 1 nateaune staff 273 Nov 18 08:35 Rakefile
drwxr-xr-x 9 nateaune staff 288 Nov 18 08:35 app
drwxr-xr-x 2 nateaune staff 64 Nov 18 08:35 attachments
drwxr-xr-x 7 nateaune staff 224 Nov 18 08:35 bin
drwxr-xr-x 19 nateaune staff 608 Nov 18 08:35 config
-rwxr-xr-x 1 nateaune staff 158 Nov 18 08:35 config.ru
-rw-r--r-- 1 nateaune staff 32198 Nov 18 08:35 config.zip
drwxr-xr-x 2 9999 9999 64 Nov 18 08:35 courses
drwxr-xr-x 5 nateaune staff 160 Nov 18 08:35 db
drwxr-xr-x 5 nateaune staff 160 Nov 18 08:35 docker
drwxr-xr-x 5 nateaune staff 160 Nov 18 08:35 examples
drwxr-xr-x 16 nateaune staff 512 Nov 18 08:35 lib
drwxr-xr-x 7 nateaune staff 224 Nov 18 08:35 public
drwxr-xr-x 16 nateaune staff 512 Nov 18 08:35 script
drwxr-xr-x 12 nateaune staff 384 Nov 18 08:35 spec
drwxr-xr-x 4 nateaune staff 128 Nov 18 08:35 templates
So I changed it to be owned by the same user that owns the other folder:
$ sudo chown -R nateaune:staff courses
And now the autolab:populate
command executes successfully!
$ docker-compose run --rm -e RAILS_ENV=production web rake autolab:populate
Starting local_tango_1_b01116f87ab0 ... done
Starting local_db_1_e6351c097e85 ... done
Creating Course AutoPopulated and config file
Creating Assessments
Creating Problems
Fast-creating Users
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
sh: 1: /usr/sbin/sendmail: not found
Fast-creating Submissions and Scores (might take a while)
Fast-creating AUDs
Creating configuration files
Creating Autograde Assessment
Population Successful
With those /usr/bin/sendmail
not found messages, which I think can be safely ignored, since they're likely just sending an email that the user was created?
When I try to run the
autolab:populate
command, this error occurs: